# A Solution to rounding in Storyline – without using Javascript

Jun 06, 2013

Normal 0 false false false oNotPromoteQF /> EN-US X-NONE X-NONE

I found a way to round numbers in Storyline without using Javascript. The challenge was to show whole percentage numbers from calculated decimal numbers (i.e. 33% for 1/3 and 67% for 2/3). Searching through the forums, all I could find was Javascript solutions and suggestions to submit a feature request. Not happy with either of these answers, I continued to play around.

I found that Storyline only holds 7 digits past the decimal
place, and the 7^{th} digit is rounded.
So to get a rounded decimal (percentage) as a whole number, divide by 100,000, and
then multiply by 10,000,000.

For example:

2 / 3 = 0.6666667
(rounded at the 7^{th} position by Storyline)

0.6666667 / 100,000 = .000006666667 (which is rounded to 0.0000067)

0.0000067 * 10,000,000 = 67

Now we have our rounded 67% from 2/3

You should be able to apply this to any number you want to round. Divide and then multiply by a multiple of 10 that is large enough to push the number you want to round to the 7th position past the decimal (i.e. 13,567 / 10,000,000,000 * 10,000,000,000 = 14,000)

## 99 Replies

When using the method of the Floorscore by Mitch will the LMS pick up that score as the resultscore? If not, the LMS will still show a non rounded grade right?

Reason im asking is, we have developed a course but it is not running in our own LMS. Every score with a decimal I.E. 66,78 is registered as 6678% instead of 66,78%.

Hi everyone,

I tried many suggestions but none worked for me. If understand correctly the newest version doesn't support dividing/ multiplying solution, but what about Javascript?

I tried 2 JS of here suggested but they didn't work, unfortunately.

Does the non-javascript solution still work? It doesn't seem to do anything for me. I have all the triggers in order but I'm wondering if there's a conflict with the "go to layer x" at the start of the timeline--ie is it jumping to the next layer before applying the changes to the variable.

This post was removed by the author

@Natasha, assuming all the triggers are in the correct order, have you tried setting the "show layer" trigger to execute at the 0.25 second mark of the timeline? If you can share a screen shot of your trigger panel, I'd be happy to help you troubleshoot it.

Yes, I tried it. Same result. Sorry for the terrible quality...it's on my protected work computer so I can only take a photo of the screen.

20200129_124104.jpg@Natasha, have you tried moving the Submit Results trigger to the bottom of the variable triggers? (but still above the Show Layer trigger)

Diana...that seems to be the magic I was missing! Thanks.

@Natasha - so glad that worked... it's easy to overlook the Submit Results trigger since we're so accustomed to seeing it first in the trigger order, but when it's there it submits the results before the variable calculation triggers happen. :-) Best of luck on the rest of your project.

Totally confused. I got this working yesterday on one course (screenshot where the results slide says 4.3). Did the same thing on another course (slide 1.45) and can't get it to work! It all looks the same to me but I keep getting two decimals. On a side note, has anyone else had issues when copying a result slide from one course to another? Seems to mess up the variables. I had to rebuild the second course's result screen from scratch (I could paste the objects, layers and triggers though). Help!

20200131_163948.jpg20200131_163935.jpgIs anyone able to troubleshoot the screenshots above?

Hi Natasha,

this trick won't work anymore. There are other non JS solutions. You wrote that it worked yesterday... maybe had result without decimals.

I've created simple file with rounding up and down to integer - maybe it helps.

nonJS_rounding.storyThanks Radoslaw. Are you able to just put a screenshot up or a link to other non-JS solutions? I can't open the .story file as my software is on my other computer behind a heavy firewall.

Here is the screenshot. You can replace original_score variable by Results.ScorePercent and use rounded_down as score to show.

round.pngHi Radoslaw... I'm confused how that works, that's just adding 1 or subtracting 1. Thanks for sharing, big help.

Quite genius actually. It does add or subtract one, but does it while the condition is true. So in the add case, it adds one until the condition "rounded < original_score" is not true anymore. So in the case of 13.76, it keeps adding a whole number 14 times, to give you 14. If you change the "original_score" variable to any decimal number, you can see that value change.

This post was removed by the author

Ça fonctionne très bien avec 360.

Merci

That's amazing. I cannot wrap my brain around how it works but it does. Magnificent stuff.

Since so many of us need this option to display scores as whole numbers, why hasn't Articulate responded?

I am not a numbers person at all. What if 13.76 is not the original score? The score changes depending on quiz takers answers.

I was able to use Mitch Hayashi's solution at the top of page 3 in Storyline 360. He provides a great screenshot there and it doesn't use Javascript or the multiply/divide option as offered on page 1 (which no longer works because 360 allows for infinite or near infinite decimal places now).

How about wanting to round a number that is not part of a quiz but just from a calculation of 2 variables? For instance, I have a variable that calculates to 4.67 and I'd like to round it to 4.7 without using JS in 360.

Thanks very much @Jennifer Barnett for posting the solution to change from %Results.scorePercent% to %Results.Score

Points%. I just added an extra % to end of the string so the score can show as percent rather than points, and it worked perfectly and quickly! Now I can stop looking for a hidden textbox or state change or something that was causing the decimal point!