Calculating percentages on the results using variables

Jan 26, 2023

Good day,
 
I have a results page with 2 variables that l am tracking. The first one is "questions answered" and the second one is "no of questions correct".
 
I want to calculate a percentage score out of these 2 variables and display for the learner. Any ideas? The percentage has to be 33% in this case below. 
 
Results
4 Replies
Jose Tansengco

Hello Phezulu,

Thanks for reaching out! 

You can perform mathematical calculations in Storyline 360 using the 'Adjust variable' trigger. Here's a screenshot of what that looks like in Storyline 360 when division is chosen as the operation: 

It looks like you already have your variables setup, so you can start setting up the mathematical operations using triggers

Andrew Crosby

I found a solution (albeit a somewhat clunky one). 

1) Create a slide that displays results (not a Results Slide).

2) I display the value for NumberCorrect. Duplicate the slide (we'll call this Results1 and the duplicate Results2). 

3) Set up a trigger so that variable PercentCorrect is set to the value of NumberCorrect when the Results1 slide starts. Don't display PercentCorrect yet.

4) Make a button called CALCULATE SCORE. Create a trigger that divides PercentCorrect by total points possible.

5) Make a trigger that moves to Results2 when user clicks CALCULATE SCORE.

6) Create a trigger that multiplies PercentCorrect by 100 when the timeline starts on this slide.

7) Now you can display the PercentCorrect variable along with the NumberCorrect. Since you duplicated the page it will appear instantaneous (as long as there aren't any transitions). 

 

 

Walt Hamilton

Andrew,

What is throwing you off is that SL can't evaluate an expression. It can perform only one math function per trigger, so your solution is correct that you have to write a trigger for each step.

You can accomplish these same actions all on one slide, using steps 3, 4, and 6. Triggers are executed one at a time, in the order they appear, from top to bottom, so you can set several triggers to one action. You can set these to fire when a button is clicked, when a  slide or layer starts, when a variable changes values, or on any other action the learner can take.

Your instinct in step 3 is correct, you don't want to change NumberCorrect.

Copy NumberCorrect to PercentCorrect, then divide PercentCorrect by TotalPoints, then multiply PercentCorrect by 100.

The percent correct will appear so fast you won't see the changes.