Forum Discussion
A Solution to rounding in Storyline – without using Javascript
- 5 days ago
Hello everyone,
I have some great news to share! We just released another update for Storyline 360. In Update 112, we’ve included essential fixes and new features. One of the new features we’ve included is:
- Simplify reporting with a built-in option that rounds quiz scores to whole numbers.
Launch the Articulate 360 desktop app on your computer to take advantage of this update, and click the Update button next to Storyline 360. You’ll find our step-by-step instructions here.
Please let me know if you need additional help.
Cheers Phil, IU thought this might the case!!!!
So has anyone got an example of a JS rounding script?
See attahced a file that uses JS to round the input from a numeric entry.
- SandyDutra8 years agoCommunity Member
I tried applying this JavaScript and it doesn't seem to work. I have an answer that shows as (i.e.) 10.454240362 and I want it to round up to 10.45
How can I apply a variable/JavaScript to make this work?
Thanks
Sandy
- OwenHolt8 years agoSuper Hero
Sandy,
You would use something like the following:
var player = GetPlayer();
var num = player.GetVar("Your StoryLine Variable");
num = Math.round((num + 0.00001) * 100) / 100;
player.SetVar("Your StoryLine Variable", num);
- LizzieWakefi4958 years agoCommunity Member
this only seems to round up to one decimal place not to a whole number am i missing something?
my result = 28.57%
after javascript = 28.6%
- OwenHolt8 years agoSuper Hero
I just tested the JavaScript and it worked as it should for me. Here are a few things to remember:
1) you can't change the StoryLine quiz variables directly. You need to set up your own variable in StoryLine and set it equal to the appropriate StoryLine quiz variable. You can then modify/manipulate your variable.
2) Order matters. Set you variable value equal to StoryLine's quiz variable 1st; as soon as the timeline starts.
3) The timeline you should be using is the slide's timeline.
4) Remember that JavaScript is case sensitive. Also, it is easier to troubleshoot if you perform steps 1 at a time. You will notice that my code performs the math round on its own line before sending the result to StoryLine. This isn't required but makes the code easier to follow and understand and facilitates debugging.- JarrodBriehof-08 years agoCommunity Member
I tested this with a short 6 question quiz. I wanted to see how the rounding would effect the actual quiz results. I made the passing percentage 67%. In testing I got 2 wrong and 4 right in which without rounding would produce a score of 66.66%. I am able to get the score percent to show as 67% and the passing percent shows as 67% but the result slide shows as fail. Am I doing something wrong?