AnsweredAssumed Answered

using global variables in a set variable

Question asked by FredGross on Jan 3, 2013
Latest reply on Jan 4, 2013 by raybaudi


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))]

     end if

     if [test2]

       set variable [$$total; value ((table::cost3) + $$total)]

     end if


     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.