using global variables in a set variable
I have a script where I set a global variable $$total to one value and the depending upon an if statement I want to add the value of a field variable to the previous global variable $$total and reassign the new total back to the same $$total. How might this be done?
What I have now is:
set variable [$$total; value: 0]
if [ test1]
set variable [$$total; value (( table::cost1) + (table::cost2))]
set variable [$$total; value ((table::cost3) + $$total)]
It behaves correctly when only test1 or test2 is true. If test1 is true and test2 is also true then $$total = cost3. I want $$total = cost1 + cost2 +cost3 if both tests are true.