Dear Community and AppSheet Champions ๐ค
Among the suggested bots, we have the suggested event "A record is created or updated".
I would like to be able to differenciate the two situations, without having to create one bot for each single-event data change.
I thought about this, but that does not work:
Would you happen to have an idea?
Solved! Go to Solution.
Maybe not very economical as it involves adding a column ๐but the following works .
Please add a ChangeCounter type column , with Accumulate mode and initial value as 0 that changes on all column changes or you can set the columns you want to designate as "Update Changes"
Then your branch condition for add/update can be
AND([_THISROW_BEFORE].[TESTCOUNTER]<>[_THISROW_AFTER].[TESTCOUNTER], [_THISROW_AFTER].[TESTCOUNTER]>1)
[TESTCOUNTER] is ChangeCounter type column here.
The Y branches to Update record Email and N branches to Add Record email
If I may add further, my testing leads me to believe that there is no concept of [_THISROW_BEFORE} or [_THISROW_AFTER] before a row is created or added the first time. This is logical because the row itself is non-existent before adding.
The help article's and its title also confirms that the said values are for updated record.
Access column values before and after an update - AppSheet Help
Even the expression that worked in the test app, essentially checks if the row is updated ( A combination of [_THISROW_BEFORE] , [_THISROW_AFTER]and ChangeCounter column being >1) and if the results is FALSE, then it considers as the row is added and it works. The point to note is detection of add condition ( A FALSE result of the expression) is indirect. If it is not updated, consider it added.
Hi @Aurelien ,
On second thought, I think even the following simpler expression will work in the branch condition. I have not tested it though.
[ChangeCounter] =1
TRUE means record is added ( [ChangeCounter] updates to 1 on record add) and FALSE means ( It is greater than 1) and record is updated.
User | Count |
---|---|
15 | |
11 | |
10 | |
8 | |
3 |