All Collections
Formulas
General formula info
Perform multiple actions with a single button
Perform multiple actions with a single button

Learn how to perform multiple actions with a single button. Build a button that can press other buttons, can add or modify rows, and more.

Updated over a week ago

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:

Screen Capture on 2023-06-14 at 12-28-45.gif

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.

Screen Shot 2023-06-14 at 12.29.21 PM.png

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:

Screen Capture on 2023-06-14 at 12-35-55.gif

The formula looks like this:

Screen Shot 2023-06-14 at 12.34.45 PM.png

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.

Did this answer your question?