Hey,I am exploring some thing new in Appain functions,Supose if user enter 1+2+3+4+5 in a text box then is there any function to evaluate this and give me the sum of all those numbers as 15.Thanks in advance.
Discussion posts and replies are publicly visible
a!localVariables( local!text: "1+2+3+4+5", local!textItems: split(local!text, "+"), local!textItemsInteger: tointeger(local!textItems), sum(local!textItemsInteger) )
Yeah, you could do that. But I don't know, seems a little brittle. Seems like something that may be better suited for an LLM.
Hey Mathieu Drouin Thanks for your response.
This will only work for sum of numbers but what I need is to calculate the whole expression which includes mathematical operations like +,-,/,*Example... If user enters 5*2+1-10/2 then the result should be 6.
There is no such function in Appian. And parsing this manually becomes a pain quickly as you need to evaluate the operations in the right order.
your options are pretty much to either manually build a parser (if you control the allowed operators tightly enough, it's doable, but cumbersome as stefan already mentioned), or use undocumented functionality like "function-which-must-not-be-named".