Array of Objects as return type?

How can one declare the return type for a Formula that returns an Array of Objects, say like:

[{'id': 'abc123', 'name': 'alice'}, {'id': 'xyz789', 'name': 'bob'}, ...]

I’m guessing you specify in the addFormula param object:

  resultType: coda.ValueType.Array,
  items: { type: coda.ValueType.Object },

But where can you specify that the items have a schema mySchema?

1 Like

Found it:

items: mySchema

(I was doing items: {type: mySchema})

May want to document this better in the usage, had to dig to this reference page to find it: Type alias: ArrayFormulaDef - Coda Pack SDK

1 Like

Ya, this tripped me up at first too. I’ll make sure we document this more clearly.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.