After adding Table A rows via external call to AppSheet API, how best to recalculate Table B rows?

I have a scenario where one table (Table A) has rows added in bulk (1000s at a time) via the AppSheet API being invoked from outside the app. I need to then force recalculation of rows (1000s at a time) in another table (Table B) that has columns with App formulas that reference the first table (Table A).

I'm planning to create an automation whose event is triggered by "Adds only" in Table A. My question is what's the best approach to implementing the data change task to be executed in one column for pertinent rows in Table B that would then trigger recalculation of Table B's other columns?

For example, it's unclear to me which of the following applies:

  1. The automation would be triggered and run only once for all the Table A rows added simultaneously.
  2. The automation would be triggered and run separately for each new Table A row.

If the behavior is #1, I assume that it's far preferable to make the automation task a webhook that invokes the AppSheet API. However, if the behavior is #2, there may not be any performance advantage to using a webhook task instead of just a task that calls a data change action defined within the app since it's going to run one row at a time anyway.

FWIW, the Add records to a table - AppSheet API Help article implies all rows are added before any resulting automation is triggered. See steps 5 and 6 here:

What happens when a record is added?

  1. All fields are initialized to initial values and all app formulas are computed.
  2. The field values you specify in the request are applied.
  3. App formulas are computed and change fields are updated.
  4. Required, Required_If, and Valid_If conditions are enforced.
  5. The record or records are added to the table.
  6. Automation workflows, if any, are invoked.
  7. The added record or records are returned in the HTTP content.

As always, any guidance regarding my questions--or how I should be thinking about this differently--is appreciated.

0 7 195
7 REPLIES 7


@dbaum wrote:

For example, it's unclear to me which of the following applies:

  1. The automation would be triggered and run only once for all the Table A rows added simultaneously.
  2. The automation would be triggered and run separately for each new Table A row.

#2

Thanks, @Marc_Dillon. That was my hunch. I'll submit feedback directly in the article, where I know that @lizlynch follows up, to suggest a clarification to step 6 that "Automation workflows, if any, are invoked separately for each new row."

Given that my planned automation would trigger and run separately for each added Table A row and that, for each Table A row, the corresponding rows to update in Table B would typically be just one or a few, do you think I'm right that there's likely no performance difference between having the automation's task run an intra-app data change action vs. be a webhook to invoke an Edit action via the AppSheet API?

Of course, if you have any different guidance regarding how best to approach this, that's also welcome. If possible, I'd obviously like to find a way that doesn't depend on the actions to update Table B running just 1-3 rows at a time for the 1000s of rows.

@dbaum @Marc_Dillon 

Thank you for tagging me and for the clarification. I've updated the article to indicate that the steps are performed separately for each new row. 

Thanks, @lizlynch.

The same point likely applies in the following articles:

@dbaum - Thank you! Most excellent catch!

The documentation now says the add/update/delete operations for all rows are performed, then the corresponding automations are all performed. As I understand it, a row's automation is performed immediately after the add/update/delete, not after all add/update/delete operations are done.

If that's the behavior, that would be a further helpful clarification. The opposite was at least implied even by the original article text. Glad this thread is leading to documentation improvements.

Also, I appreciate any guidance regarding the original question: What's the most efficient way to recalculate Table B rows upon adding Table A rows via external call to AppSheet API?

Top Labels in this Space