Runactions() with lookup value

Hi all

I want to take an action depening of a status of a row.
I prepared the actions via button, now made a lookup and included this into a formula RunActions(lookup value)

Question: how does the lookup value needs to be formatted to run?
Like I did it’s not working :wink:
Bildschirmfoto 2020-04-02 um 11.08.22

Coda doesn’t work that way. You cannot put a formula text in a cell and then have some other control evaluate it; there’s no dynamic evaluation. *

You have to put all the code in your Action formula.

If you need some dynamic behavior (e.g. execute one thing for one status and another thing for another status), you can still use If(), SwitchIf(), Switch() etc in your action formula, e.g.

If(
  thisRow.IsAdmin,
  Polls.AddRow(
    [Admin template], thisRow.Template,
    ...
  ).Activate(),
  Polls.AddRow(
    [My template], thisRow.Template,
    ...
  ).Activate()
)
  • — There is actually a way to dynamically substitute actions in a button with a hack, but it is extremely unsafe, can break your doc beyond recovery at any Coda update, and requires deep knowledge of how Coda works internally, so I totally discourage it. I’m just leaving this here for the sake of completeness of the answer.
1 Like

Thanks Paul for your quick answer, as always great response :rocket:
Need to check how I will implement it.

Btw: do you know how to set the color and icon of a button via formula?

Yes, but it’s also a hack and therefore unsafe. Mistyping the color or icon name or having Coda evaluate it before you have a chance to finish typing it in will crash your doc.

and a few answers below there’s a list of values to use for an icon.

I personally prefer using emoji in button labels instead of setting one of those 20 button icons. Also keeping buttons white but coloring the label is a nice (and safer, and less performance-heavy) alternative

1 Like