Hi there, i am trying implement multiple actions on basis of an If condition output.
But when i add the formula If(thisRow.[ColumnName].IsNotBlank(), RunActions(....) , "")
, i was getting error of Formula RunActions is not a formula we currently support
. Same is happening if i try to do ModifyRows.
Is this possible, if yes please correct me with proper syntax.
Thanks
Hey there!
That error appears if you are attempting to use an action formula outside of a button
RunActions() along with every other action formula must be used Inside a button
Thanks Scott.
I was trying automate a task, is there any way to trigger a button based on value of another cell/column.
Yes! I actually wasn’t completely thorough in my answer - action formulas can also run inside automations
You would want to run a row changed automation that triggers when the row/cell/column changes to the target value
But with such limited context on your actual use case it’s hard to help out more
Yes, there is.
You cannot use runActions() in the then or else parts of the if() formula, but you CAN trigger a button. And that button can contain the runActions() Action.
Please see the following screenshots:
The example below implements a toggle button, that will switch the status of a task between “Done” and “Not Done”.
The first time you click the “If with Buttons” button, it will set the Checkbox to true/ checked, and add a row to the Archive table. If you click it again, it will reverse the previous action.
This is the logic in the if() button:
This is the logic in the “Done” button that gets pushed when the task is set to done:
This is the logic in the “UnDone” button that gets pushed when the toggle is reversed:
Further application:
This makes it possible to implement simple sub-routines in the Coda Formula language. You can define buttons with logic that can be re-used, and then “push” them as needed from elsewhere in your document.
Parameter passing is something that you would need to set up yourself using a temporary table to store the parameters, and you would need to ensure that those temporary values get deleted again. But it is doable.
Here is a link to the doc with the above example:
It’s just a ramble…
Rambling Pete
What do you mean you can’t?.. Hold on, I don’t remember such limitation
Just checked; you totally can
You can totally combine actions with RunActions, conditionals, loops etc. The only thing that matters there is that ultimately the formula must resolve to an action (e.g. multiple steps combined into a ‘compound’ action via RunActions()
) or a list of actions (e.g. an output of Items.ForEach(CurrentValue.ModifyRows(...))
— not strictly necessary to wrap into RunActions()
)
perhaps he meant you cannot use ACTIONS in the then or else part of an if inside a column FORMULA, only in a button or automation.
In a column formula you get the below:
Yeah, actions can only be used in action contexts, not formula columns.
Perhaps I misunderstood @Piet_Strydom’s reply. It went great lengths to explain how to conditionally trigger complex actions with separate buttons, so I assumed that was his idea – saying that one needed to split out an action if they wanted an If() in their action. So I was just going to say that one didn’t, in fact, need separate buttons to separately code an If() statement within an action. A whole action with separate steps, loops, and conditionals can be totally contained in a single button’s action formula.
The OP was a post from Dushyant, where he got the error message.
My response was to show him that a workaround exists.
I then expanded on the idea.
P
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.