Adding a row to a table from a document level button

Hello all!

If I have a button on my document that calls an addFormula that returns a schema’d object is there an easy way to just populate a table with that object’s properties?

Right now, the only thing I have discovered is to save the json result to some dummy hidden column temporarily, then parse the JSON. A technique learned here: How to Coda with JSON — Extra. Bringing data in and distributing it… | by Christiaan Huizer | Medium

    [User Details],
    Email = User().Email,
    [My Pack]::RunDemoTest([My User], User().Email)
    [User Details],
    Email = User().Email,
    [Image URL],
    [User Created Date],

Is that the standard or is there a simpler method that’s eluding me?

Thanks for any insight!

Hey there!

You have two main options.

First - return the raw json from the pack into a column and then write formulas in your other columns to parse out the JSON

There’s no need to have the add/modify rows parse the json in your button. The column formulas themself Can just parse out that info.

Second - instead of writing an action formula in your pack (which cannot return objects with schemas that Coda can understand), write your pack formula as a regular formula that returns a returnType: object with a defined schema in the pack.

Then use your button to modify a row with the result of that formula. That should allow you to chain out the values inside the returned object.


Ah, thanks so much Scott, this was the information I needed, specifically the second option. This was why I wasn’t able to autocomplete values in the Formula Editor as the isAction was true.

I was also able to figure out how to do with an array of objects as well with this information so I can add multiple rows.