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.
Although there aren't any built-in methods offered within Storyline, there are solutions/workarounds created by members of the community. One solution for rounding up the percentages is discussed over here.
As Rutwin mentioned there are no built in methods to round the decimal points, but it's been a common feature request of late if you'd like to join in and submit one of your own.
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.
Absolutely Ashley. I'm using SumTotal as my LMS and the issue is that the quiz is reporting scores with decimals such as 13.33% instead of 13%. Although I can round out the score for the user on the results slide, Storyline still reports the percent with decimals.
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.
Hi, I'm not a javascript guy and need some help on this, could someone walk me through the process of actually how to implement this? I'm sort of rusty using Storyline and would appreciate some screen shots.
I'm not certain that folks are still subscribed here, so you may want to reach out to Pauly or others using the "contact me" button on their profile to see if they're able to offer assistance around this issue.
Hi Ashley, thanks for reaching out. I actually figured this one out and am
planning on posting a play-by-play how to in the near future for people
like me who need the extra visuals and steps.
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?
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:
%Variable%%
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.
Any thoughts on why this would have worked on one course and not the other? I copied and pasted the slide into the new course but can't get it to work.
Take a look at the Variables window to see if you've got a second instance of the Results.ScorePercent there. If you need extra help, feel free to share your .story file here so the community can take a peek at what you've got set up so far!
68 Replies
Although there aren't any built-in methods offered within Storyline, there are solutions/workarounds created by members of the community. One solution for rounding up the percentages is discussed over here.
Hi Rich,
As Rutwin mentioned there are no built in methods to round the decimal points, but it's been a common feature request of late if you'd like to join in and submit one of your own.
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.
Thanks for popping in with your suggestions Pauly :)
Has anyone found a way to remove the decimals points with the LMS?
Hi Ed,
You may want to share with LMS you're using so that folks can share additional information here.
Absolutely Ashley. I'm using SumTotal as my LMS and the issue is that the quiz is reporting scores with decimals such as 13.33% instead of 13%. Although I can round out the score for the user on the results slide, Storyline still reports the percent with decimals.
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.
I attempted your suggestion along with many others. Looks like I have to accept that Storyline is not capable of this.
Submitted a feature request.
I am still open for suggestions.
Thanks.
Hi, I'm not a javascript guy and need some help on this, could someone walk me through the process of actually how to implement this? I'm sort of rusty using Storyline and would appreciate some screen shots.
best
Mike
Hi Mike,
I'm not certain that folks are still subscribed here, so you may want to reach out to Pauly or others using the "contact me" button on their profile to see if they're able to offer assistance around this issue.
Hi Ashley, thanks for reaching out. I actually figured this one out and am
planning on posting a play-by-play how to in the near future for people
like me who need the extra visuals and steps.
Again, thanks.
Mike
Love a play by play - so looking forward to seeing it!
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
Hey Tony, pretty elegant solution, thanks!
Mike
No problem Mike :)
I should have added that if you use:
player.SetVar("Results.ScorePercent", Math.round(score));
as well it will pass the same rounded figure to the LMS, for some reason, I coudn't get the Results variable to update...
TC
Thanks for the update, Tony!
This is beautiful! Thank you!
Glad that this thread was able to assist you as well Sherrie. Thanks for popping in :)
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?
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:
%Variable%%
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!
As Pauly said :)
Any thoughts on why this would have worked on one course and not the other? I copied and pasted the slide into the new course but can't get it to work.
If you copy and pasted there is a good chance It might of made another Results.ScorePercent variable which would confuse the trigger.
Hi Natasha,
Take a look at the Variables window to see if you've got a second instance of the Results.ScorePercent there. If you need extra help, feel free to share your .story file here so the community can take a peek at what you've got set up so far!