Results Slide Percent no Decimal Points

Jan 03, 2014


 I have a results slide which pulls in data from several other results slide.

 The problem is that the results percentage is showing the percentage with decimal points. From a cosmetic point of view I would like the percentage rate to be rounded up or down to the nearest full number.

Is there a way to do this?

Thank you in advance


68 Replies
Pauly Barnes

I have some javascript code that may probably work for this scenario. Take the code and put it into an Javascript executable trigger on the results page and have it start first.

var player = GetPlayer();
var score = player.GetVar("Results.ScorePercent");
var n = score.toFixed(0);
player.SetVar("Results.ScorePercent", n);

The non javascript workaround can be messy in your triggers pane on the results slide. However, here is another solution. Maybe someday Articulate will make a consideration and have decimals as an option.

Ashley Terwilliger-Pollard

Hi Ed,

Within Storyline I know people round using Javascript to change the slide variable listed but as far as reporting that to your LMS - I'm not certain of the steps there and Javascript is not something I can offer support for. 

You may want to review the method in this thread about rounding without Javascript - to see if something like that would work for you. 

Tony Chilvers

I found this thread while looking for a solution to the same problem.

What I did:

1.       Insert a numerical variable called myScore
2.       Insert a trigger on the results slide adjusting myScore to the value of the Results.ScorePercent.

3.       Insert a new trigger to Execute JavaScript when the timeline starts

4.       Click on the … button, and insert the code below into the panel that opens

var player = GetPlayer();
var score = player.GetVar("myScore");
player.SetVar("myScore", Math.round(score));

 5.       Now edit your Results slide text to display %myScore% instead of %Results.ScorePercent% as below.

Job done :)

Tony C

Natasha Bomba

HI. Can you clarify--When you say edit the results slide--should it only say "%myScore% and not the info in the brackets? Or do you keep the brackets and change the text to "MyScore"? Is it a double %% at the end or a single? I assume points or percent refers to the same thing in step 5?

Also, does the trigger to send results to the LMS need to be after the Java Script trigger in the order?

Pauly Barnes

The double percent is because you actually want it to say %. So to read 80%, where 80 is the variable, it would look like this:


for step 5 I would assume you leave whats in the brackets alone since those are referring to points rather than percentages. I usually delete the entire bracketed area since we do not utilize points.

Also, to answer your final question, the script to send needs to be AFTER the javascript or it will send the incorrect value.

Hope this helps!