Action to write value summed from children tests fine but return zero

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

0 9 147
9 REPLIES 9

I just setup what I believe is the exact same thing, and it works as expected for me:

3X_e_5_e5b5ed08a6e5949ad40b05e577128ad99232a3b7.png


3X_6_8_6829a520d9eee6010ee4f3ebdbbd32e80fee79ae.png

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

Steve
Platinum 4
Platinum 4

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

Top Labels in this Space