How to Calculate Sum of Numeric Entries in Articulate Storyline
This blog shares the steps to calculate the sum of numeric entry fields in Articulate Storyline 2.
Articulate Storyline is a versatile e-learning courseware authoring tool that allows learning designers and developers meet creative learning requirements that go a long way in engaging learners and making learning impactful. It also eases the task of developing custom solutions through the use of Triggers and Variables.
In this post, I would like to share one unique requirement we customized for our client.
We were asked to add the values in all the numeric entry fields in a slide whenever a learner clicks the Add button.
For example, if there are 4 sections in a class, we need to add the number of students in each section and calculate the total number of students. The learner should be able to enter the value for each section dynamically.
Here is how we met the above requirement. (Please note that Articulate Storyline provides 2 data entry fields – Text entry and Numeric entry.)
Step 1: Create a new slide and insert a numeric entry field for each section in a class (example screenshot given below).
Step 2: In Storyline, for numeric entry fields, a variable is created by default and initialized to the typed value. Here we create 4 variables: NumericEntry, NumericEntry1, NumericEntry2, and NumericEntry3.
Step 3: Insert an Add button to the slide.
Step 4: Create a number variable TotalStudents with initial value ‘0’.
Step 5: Add the triggers given below to the Add button in the same sequence.
Trigger 1: Adjust the value of the variable TotalStudents to ‘0’ when the learner clicks the Add button.
Trigger 2: Add the value in the variable NumericEntry to TotalStudents when the learner clicks the Add button.
Trigger 3: Add the value in the variable NumericEntry1 value to TotalStudents when the learner clicks the Add button.
Repeat this Trigger for the remaining variables – NumericEntry2 and NumericEntry3.
Step 6: Insert the variable TotalStudents between two percentage symbols in a text field to print the total students in the class.
Publish or preview the course and see the output.
In this way, we can calculate the sum of numeric entries in Articulate Storyline. Hope you found this post useful. Do share your thoughts.