Await Action in formula

Hi,
I have a formula marked as “isAction” = true in my Pack. The execution will post to an external API and get for the result.

When I try with Coda formula CopyToClipboard as below

CopyToClipboard(Myformula), the CopyToClipboard action will never wait for my formula execution, since it run as async process. Is there any way to wait for the API response, then only perform the CopyToClipboard action?

This could be a bug. One action should wait for a result of another action (like ModifyRows() waits for AddRow() or literally any other pack formula to return the result).

One easy thing to try is to do it like:

CopyToClipboard(
  RunActions(
    YourFormula()
  )
)

— i.e. wrap your formula with RunActions().

If that fails, another way is to store the result to some temporary row somewhere and then use it with the copy function.

E.g., make a table TempTable with a single row and TempValue column and then:

RunActions(
  TempTable.ModifyRows(
    TempTable.TempValue, MyFormula()
  ),
  CopyToClipboard(
    TempTable.TempValue.First()
  )
)
3 Likes

HI Paul ,

Yes, confirmed that this is not working if the formula is marked as “isAction = true” in the pack.
Somehow storing in a temp table by updating the row is not an option for us. Do you foresee this bug will be fix soon?

Something else you could try is:

RunActions( modifyRows(thisRow, columnA, postCall()),copyToClipboard(thisRow.columnA))

Essentially, make the first action within a button modify a column with the result of your custom pack call

Then have the second action in the button copy the result of that call. Haven’t tested but should work?

1 Like

Hi Kang,

Please report the bug using the question mark on the bottom rightt of your document.

Regards
Piet

1 Like

Unfortunately, this is not an option for me, as I dont want to update a table column which the text will be visible to other users via the table or the page history.

I will proceed to log a bug ticket.

Thanks all for the replies.