Why cant I sum numeric attributes in an xPath constraint?
1
I have a microflow retrieve object action (retrieve from database). I want to retrieve all objects where the sum of 2 numeric attributes is greater than the value of a third numeric attribute, so I am setting an xPath constraint : [IssuedQuantity + DisposedQuantity > ReceivedQuantity] This is returning an error "no viable alterenative at input 'IssuedQuantity' The Mendix ref guide5 (https://world.mendix.com/display/refguide5/XPath+Expressions) has the following comparable example: //Sales.Order[TotalPrice + ShippingPrice < 50.00] So why is my constraint failing? And what does this error actually mean? It seems to be a syntax error relating to the first part of the expression (the sum), but I have tried every permutation of brackets & parentheses I can think of & nothing works. Thanks.
asked
Andy Whiteley
3 answers
0
Maybe the internal xpath engine may support this but the documentation is incorrect. Both the forms and microflow retrieve XPath do not allow plus(+) and minus (-) operators. This was already the case in 4.3.2.
answered
Chris de Gelder
0
Unfortunately, Mendix XPath differs somewhat from 'real' XPath.
I also elaborated upon this a little in this thread:
As of now, Mendix doesn't support calculations in your XPath queries (among other things).
answered
Jeffrey Kwee
0
I did it like this. I used a create variable. and on the create variable, I typed aggregated amounts + or - the other values. I did with Decimals and integers.