Hello,
In my attempt to optimize my apps , today I replaced some spreasheet formula with an appsheet action button, to write in a parent column the sum of a child table column (set values in this row) , something like
[ParentColumnSum]=sum([RefColToChild][ChildQuantity])
When testing the formula, results were perfect in testing page.
When using the action, it wrote 0 in my spreasheet.
I rewrote the action using select instead of child referencing
[ParentColumnSum]=sum(select(etcโฆ)) , and it works just fine.
There were no slices, no security filters, so my question/curiosity is why the first version of action tested correctly but wrote zero in spreasheet.
Thank you for helping me understand
I just setup what I believe is the exact same thing, and it works as expected for me:
Iโd assume the answer as to why it didnโt work for you lies somewhere else.
I just saw, you are summing the keys from children, I was summing another column in children. I will study if this has any effect
In my experience, the Related โฆ virtual columns are unreliable. Use SELECT() instead as you have.
Really? Any ideas why, or under what circumstance? Iโve used them a lot and canโt recall a single instance where they didnโt work as above.
@WillowMobileSystems this is related to what you were asking in that thread the other day, although still no solid answer.
This might be what I was thinking of - usage of โRelatedโ columns. The post you mention was about the similar shorthand for tables.
I have had instances where referencing related columns (like in the SUM above) didnโt work in very complex expressions. What I did instead of a whole other SELECT(), was to assign a virtual column to the shorthand expression. For instance, in the SUM expression above I would do this:
New Virtual Column = [RefColToChild][ChildQuantity]
Then I would write the summation as SUM([New Virtual Column])
The VC technique worked in my case too, while testing options. My end goal being speeding up, I avoided VC .
Still, itโs the simplest expression, so in theory the VC should not be needed
Agreed!!
Be careful on how you analyze which is faster in this particular use case - VC or SELECT(). It will depend on where the SUM happens and how big the table is.
Thank you. My action is a manual only one (button), rarely used, so I preffer the speed up sync
Iโm intrigued too. It happened to me once before , but that time I was using the filter all rows option, so they were filtered out before the action triggered
User | Count |
---|---|
40 | |
34 | |
29 | |
23 | |
17 |