Forum Discussion
Adding and subtracting variables
You need to keep track of the previous as well as the current value from each dropdown to know if the total should go up or down. I would probably make an additional variable for each, suffixed with _prev. I would also create another variable for each suffixed _deltaValue (to track the net chnage between the current and previous selection).
Set all to 0 to start. Upon selection, set the current variable. Use trigger logic to set _deltaValue to equal the difference between the current and previous value. Then set the previous to equal the current value so its ready for any future selection changes.
Finally, use the _deltaValue for each to add to the running total. That way, increases or decreases in cost will automatically be accounted for by the positive or negative _deltaValues.
You could use some JavaScript to consolidate and simplify the calculations without all the triggers, but this approach should work too.
Thank you Nathan! I wanted to follow up that I have been able to make headway with one of the drop-down logic using your advice.