Greetings,
I want to take a field out a table which is a text string. For use in a report I want to convert this string into it's elements. I have the expression "200 + 300 - 400" stored as a string. What i want to do for the report is actually do the math. so i want to convert the string to:
myTotal = 200 + 300 - 400
the reason i'm doing this is because i want the report to be flexible enough for the user to evaluate their own expressions. so it might not nessessarily be 3 elements. the expression might be "100 / 5.7". Can someone out there help me out?
As long as the elements are delimited by spaces, it seems you could have a parser which would take the appropriate action based on the operator (+ - * /). However, if your statements allow parentheses (to determine order of processing) and you want to do the standard math order (* / before + -, etc.), then some kind of recursive function is what you would want.
What operators do they have besides the +, -, *, and /? Exponentiation, square roots, logs, etc.?
Ken