I need to define actions that add another row to another table but on updates I don't want to overwrite any existing data. My use case is I am collecting some telemetry for edits made by a user. I created a grouped action with the first action "Add a new row to another table" followed by an action that increments a count in that row by filtering the row I just added. Then I perform an increment action. When I first tried this, I noticed that Adding to the same row does not affect the values I did not touch. But after I migrated my target table to another spreadsheet the behavior changed. I saw the Add action started clearing out my counter. After trying to find any configuration differences I gave up. And just simplified to one action, that figures out if there is an existing value and incrementing accordingly when performing the Add.
But I did this in only one place. And wanted to understand what the correct behavior is. Is there an option I selected somewhere that changes the behavior of "Add another row to a table" or it was a timing fluke that it was ever working. Appreciate any help in this regard.
Edit: Added details and screenshots here: https://www.googlecloudcommunity.com/gc/AppSheet-Q-A/What-is-the-correct-way-to-add-update-a-row-in-...
Would you please include screenshot to ease understanding your case and the desired behavior?
Shared some screenshots in the other reply.
@ali-hussain wrote:I created a grouped action with the first action "Add a new row to another table" followed by an action that increments a count in that row by filtering the row I just added. Then I perform an increment action.
This is unclear. As requested by @Joseph_Seddik, please post screenshots showing exactly how these actions are configured.
I'm curious, too, why you have a separate action to increment the counter in the row you just added rather than including the final value in the row as you added it.
The "Why" is pretty straightforward. I was hoping to not create this monstrosity of an equation.
Although having done it once my aversion to it is significantly reduced. So I did create the action like this:
But in my past actions I created I had it as a two step sequence:
โ
(Set up the key so I can recall it easily)
The thing is this version worked, and the Add did not reset the row.
Now I should probably just use the monstrous equation because one monstrous equation is better than 3 actions with simple equations. But I wanted to understand how add works. If you try to add the same key twice, is an add through an action supposed to perform an update with the payload or decide there is nothing to add.
This:
can be simplified to just (LOOKUP(...) + 1). If LOOKUP(...) returns a blank value, that blank value is taken as 0 in a numeric expression.
Thank you. I was thinking I should be able to do that but didn't find a confirmation in the docs.
User | Count |
---|---|
31 | |
11 | |
3 | |
3 | |
2 |