I have an expression that is working in the e...

I have an expression that is working in the expression builder but not in the app.

It is using data from two tables Product and PurchaseOrderDetails. I am try to make an action to change the value in a column to add the value in this expression:

Sum(select(PurchaseOrderDetails[Quantity], and([ProductID]=[_thisrow].[ProductID], or([Order Status] = โ€œโ€, [Order Status] =โ€œSubmittedโ€, [Order Status] =โ€œOrderedโ€))))

To a column [bought] but the action changes it to 0 , which is a different result from the expression builder.

If I put the expression in a virtual column then create the same action it works.

I was hoping someone could tell me why?

0 14 441
14 REPLIES 14

Try to use it first without [Order Status]="" and see what happens.

The action is not performed, 14 stays at 14, and not showing changes to 0.

[bought] + 4

@Daniel_Armstrong All of the quotation marks in the expression you posted originally are โ€œintelligent quotesโ€, in that the leading pair is rightside-up and the trailing pair are upside-down. Itโ€™s possible different parts of AppSheet handle intelligent quotes differently, and therefore interpret your expression in different ways, resulting in the inconsistent results youโ€™re seeing.

Can you try replacing the intelligent quotes with regular double-quotes? Alternatively, remove the quotation marks entirely around Submitted and Ordered, and replace [Order Status] = โ€œโ€ with isblank([Order Status]).

+Steve Coile That is very interesting! I will check that out

Thanks for the tip

+Steve Coile I still couldnโ€™t figure it out, but at least I learned about the quotes. I just put it in a virtual column its all good. I donโ€™t want to mess with it any more. Thank you for your help.

What should be the correct value in your test?

14 should become 28, because there are 14 in the sum.

The weird part is it works in the expression builder, and works when I put the sum in a vertical column, and use that action to add the two columns but not when it is a column + the sum.

@Daniel_Armstrong So is the value of [bought] changed from 14 to 0, or does it remain at 14 (as if 0 was added)? Iโ€™m confused because you say, โ€œI am trying to [โ€ฆ] to add the value [โ€ฆ]โ€ rather than โ€œto set the valueโ€.

+Steve Coile Oh sorry [bought] stays at 14 when I use the sum in the expression

@Daniel_Armstrong So Iโ€™m guessing you have an action with:

If this condition is true of true

Do this of Data: set the value of a column

Set this column of bought

To this value of [_this] + Sum(select(PurchaseOrderDetails[Quantity], and([ProductID]=[_thisrow].[ProductID], or([Order Status] = โ€œโ€, [Order Status] =โ€œSubmittedโ€, [Order Status] =โ€œOrderedโ€))))

Is this correct?

+Steve Coile

Yes, it sums [bought] andโ€ the purchases that are coming soon(the expression). It doesnโ€™t use an if condition, but it filters out certain types of orders.

I really just wanted to know what causes the expression to work in expression builder but not work in the app. Can actions not run expressions from multiple tables?

@Daniel_Armstrong I would expect the action to work as desired. Does the action work if you remove the existing formula and replace it with a fixed value, like 42, just to confirm it?

Yes

Top Labels in this Space