any ideas on how I would add and/or subtract a string of numbers? I was able to figure it out if the string is only adding numbers but not both.
For example:
a user would enter numbers into a field (similar to a spreadsheet) like 100+200+300 and then hit enter. I want to then show the total which would be 600. again, I was able to write a function to do that but what if the string had a combination of "+" and "-"... like 100+200+300-50 or 100-50+200-75....
Thanks, Dan
adding / subtracting numbers
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: adding / subtracting numbers
I would split the string by minus, plus ..., setup another array with the signs and write a function that does the math.
Robert
Robert
Re: adding / subtracting numbers
This might not be what you want, but if you have, for example, a field “test”, and type in:
10 + 20 – 5
... then, in the message box, enter:
put field “test”
... it will return:
“10 + 20 – 5”
If instead you enter:
put the value of field “test”
... it returns the computed value:
“25”
Thus “the value of” a container gives you, in this case, the computed value.
10 + 20 – 5
... then, in the message box, enter:
put field “test”
... it will return:
“10 + 20 – 5”
If instead you enter:
put the value of field “test”
... it returns the computed value:
“25”
Thus “the value of” a container gives you, in this case, the computed value.
Re: adding / subtracting numbers
thanks, that worked.... so simple 
