String that must be a formula ... Eval?

String that must be a formula ... Eval?

  
Hello,

I have one string with the formula (aux)... and I need to calculate it and have an integer as result (r).
How can I use Eval()?

aux = "(1 + 2) / 3"

I need the result

r = 1

Is that possible? :D
Thank you
Hi Carolina,

Maybe you can do that using an advanced query combined with expand inline option

So make an advanced query with an string as parameter which is marked as expand inline

Return value will be decimal or integer based on the calculation you want to do

I hope this helps

regards

Wim
Thank you!!! Works fine.

For the division by zero, I managed using

NULLIF(xx,0)

So the query is something like that:

SELECT ISNULL(3.0/NULLIF(6.0,0),0)

(I've included the decimal because I need SQL to return decimal, but you can use it without the 0)

SELECT ISNULL(3/NULLIF(6,0),0)