Forum Discussion

MaRe's avatar
MaRe
Community Member
3 months ago

Percentages on the results slide without decimals

Hey there,

I have created a quiz. Everything works. On the results page the percentages achieved are displayed with 2 decimal places. How can I change this to a whole number, without a decimal range? 

KR

  • You need to create your own custom variable and display that instead of the SL built in one:

    • Make a new number variable, called RoundedPercent (use any name you want, but has to be consistent throughout)
    • Make a trigger on the Results Slide that sets RoundedPercent to the SL built in score

     

     

    • Follow that with a trigger to Execute JavaScript to round the number for you
    var player = GetPlayer();
    var score = player.GetVar("RoundedPercent");
    player.SetVar("RoundedPercent", Math.round(score));
    • Finally, make sure you are displaying your new RoundedPercent variable on the results slide stage instead of the SL built in one.
    • MaRe's avatar
      MaRe
      Community Member

      Sounds not as easy as aspected 😅 I will give this a try. Thanks a lot!

      • JudyNollet's avatar
        JudyNollet
        Super Hero

        Here's a simple alternative approach: Don't show the percentages at all. Instead, only show the points

        The default point value for a correct answer is 10 points. Depending on the number of questions and the %-correct required to pass, the built-in PassPoints variable might have a decimal. If that's the case, don't display the reference to the PassPoints variable. Instead, just enter the number of questions needed to pass.

        Here's another option to consider: Change the questions so they're only worth 1 point each. Then the results can be presented in a "you correctly answered [ScorePoints] out of [total possible points]" format.

        • FYI: You assign/edit points in FORM VIEW (see attached image).