Creating a Sum variable with number variables

May 11, 2017

Is there a way of creating a variable that adds up the total of 3 other number variables?

14 Replies
Walt Hamilton

At the point where you want the addition to be done, for example, the user clicks the Calculate button, use these triggers:

Adjust variable TotalSum assign value 0 when user clicks Calculate

Adjust variable TotalSum add variable PartOne when user clicks ...

Adjust variable TotalSum add variable PartTwo when user ...

Adjust variable TotalSum add variable PartThree when user ...

Allison Goldthorpe

Hi Howie, if you want more inspiration, check out eLearning Challenge #162. My entry had users enter their own variable numbers, then adds the value of those together. As Walt said, you could have anything cause the variables to be added. You just want to make sure there's a way to reset the total number variable should the user go back in the course, so you don't end up adding the numbers over again.

Phil Mayor

You would need triggers to change the variable values on that screen, you could do it when variable changes but could get into a real mess. If however you add a trigger to run the calculation the first variable changes and ensure the first trigger resets the calculated vale to 0  before you run the calculation there should not be a problem,.

Although looking at your design i would try and do it over three pages in stead, two pages where they complete the assessment and another with the results, it does look odd entering the page seeing the results but still needing to complete them.

Walt Hamilton

The addition of 14 - 21 is all done when the timeline starts, and the values are still 0. Your problem is to find something to trigger the calculations, and the bigger problem is is has to start only after all the selections are made. That makes it tough, because people may miss one, or change their mind.

I think the fastest way is to put the results and the triggers to add 14 - 21 on a layer. Put a button on the page that says I'm done, show me the results, or some such. Have it show the layer which can do the calculations when its timeline starts.

This discussion is closed. You can start a new discussion or contact Articulate Support.