Forum Discussion
Results Slide Percent no Decimal Points
All,
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
Rich
- TonyChilversCommunity Member
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
- MikeDelaneyCommunity Member
Hey Tony, pretty elegant solution, thanks!
Mike
- SherrieFrench1Community Member
This is beautiful! Thank you!
- NatashaBomba-Community Member
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?
- PaulyBarnes1Community Member
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!
- TonyChilversCommunity Member
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
- PaulyBarnes1Community Member
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.- MikeDelaneyCommunity Member
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
- shashankkatiyarCommunity Member
Hi Pauly,
Can you just provide a short of example assessment with this Js so that that would be very easy for me to incorporate it.
- TonyChilversCommunity Member
Hi Rebecca,
Sorry I can't open a SL3 package.
I have attached a very basic example of this from SL1, the results slide is where all the JavaScript has been added.Hope that helps.
TC- RebeccaCarterCommunity Member
Thank you so much for your speedy reply! I have now managed to get this to work!! HOORAY!
I had the triggers in the wrong order all this time and that was causing it to not work properly.
Can't thank you enough!
- MaureenMatsumotCommunity Member
Hi Tony,
I was hoping that I could find a solution to this problem!
Thank you so for the attached file. I got it to work in Storyline 360!!
Thank you!!
Maureen
- TeresaVanderposCommunity Member
Hi Maureen,
I see you got the decimal point to work in Storyline 360, I still haven't managed to, would you mind sharing the file? I would love to see it....Thanks Teresa
Thanks for popping in with your suggestions Pauly :)
- EdGenCommunity Member
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.
- RutwinGeuverinkCommunity Member
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.
- EdGenCommunity Member
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.