Skip to main content
September 27, 2016
Answered

Round or Truncate a calculated numerical variable

  • September 27, 2016
  • 1 reply
  • 429 views

I'm turning CPQuizInfoPointsScored into a percentage and displaying this to the learner. Sometimes this comes out as a whole number and sometimes it shows as something like 97.597613269726%, which isn't really desirable. When I display the variable in a text box, I'm using the 'X' and setting 'maximum length' to 3, but this doesn't seem to have any effect.

Any ideas how I can round our truncate the calculated variable?

    This topic has been closed for replies.
    Correct answer Lilybiri

    Is there any particular reason why you do not want to use the quizzing system variable cpInfoPercentage?

    The workaround would need a JS function, either Math.floor() or Math.round()

    1 reply

    Lilybiri
    LilybiriCorrect answer
    Legend
    September 27, 2016

    Is there any particular reason why you do not want to use the quizzing system variable cpInfoPercentage?

    The workaround would need a JS function, either Math.floor() or Math.round()

    September 27, 2016

    Um... that would be because I didn't know that variable existed - I was looking for something starting "cpQuizInfo..."

    Many thanks.

    Lilybiri
    Legend
    September 27, 2016

    I know, it is confusing that some quizzing system variables do not have the Quiz in their name, same with the variables for review mode and scope. Maybe you should download the table I offer for free in this blog post:

    System variables in Captivate 8/9 - Captivate blog