You may already know that you can use buttons to press other buttons. With this in your pocket, you're already able to use a single button to perform multiple actions. If you'd prefer this to be contained to one button, you're in luck!
⭐ Coda Tips!
RunActions() is a great way to perform multiple actions at once.
Let's see an example where we add multiple rows to the same table:
Here, we have a button above a table to add new rows. Without RunActions(), we'd only be able to generate one row per button press. With it, we're able to add three new rows with differing values. Let's take a closer look at the formula.
It may look intimidating at first glance, so let's break it down.
RunActions() allows us to run one or more actions, separated by a comma.
AddRow() requires three values for input separated by commas: table, column, and value.
In this example, we are running three AddRow() actions, so all of these are separated by commas within RunActions(). Within each AddRow() action, we specify the table, column name, and the new value we'd like to add. The structure ultimately looks like this:
RunActions(AddRow(Table, Table.Column, "Value 1"), AddRow(Table, Table.Column, "Value 2"), AddRow(Table, Table.Column, "Value 3"))
Now, here's an example where we modify values in two separate tables with one button press:
The formula looks like this:
You can see here that the structure follows the same format as we saw above. The two differences are that we are using ModifyRows() versus AddRows(), though both follow the same structure, and that we are working with two separate tables versus one.
Any action applies here, not just adding or modifying rows. You can use RunActions() to modify a row and push a button within a single button press.
Last thing to note is that actions are run sequentially, so make sure the formula order matches the order in which you'd prefer the actions to be run.