Hi guys - in Alteryx - how do you convert a string with operators into a value? Basically my data comes in as a string with a operators and I want it converted to a value .
Eg:
15 + 45 + 10 + 5 should be 75
Thanks so much.
Solved! Go to Solution.
Hi @oaingo
Do the operators vary? That is, might you get 10 + 40 - 5? As that would be a bit more complex?
I've attached a simple way of doing it if you are always summing the result to give you an idea.
Regards,
Ben
Currently, I only need to use 1 operator +. Please give me ideas if I use operators vary
Many thanks
Hi @oaingo,
If your operators are going to vary then it becomes more complex.
Including subtraction is pretty straight forward, but getting into multiplication and division you need to consider the order of operations.
I've included a basic routine that will do addition and subtraction to give you something more to look at. If you want to add in multiplication etc. then think about how you group your values and the order you would apply your operations.
Regards,
Ben