dominKnow | ONE provides a number of system variables such as Learner Progress and Test scores. This information is typically displayed on endscreens, but you may wish to customize those endscreens or even create your own variables. With most of these variables they will also provide data down to several decimal places. Such as 54.745. This may be too many decimal places for you and you might simply want the number to be rounded up to the nearest whole number.
Fortunately its very easy to do this with a javascript function.
Simply create an action to set a NEW variable and in the spot where you would set the new variable to a value use the following nomenclature
Math.ceil({{Variable.You.Are.Rounding}})
You will type in the function, include opening and closing parenthesis and then put the custom or system variable you wish to round in between. Then the new variable you created in this action will have the desired whole number! That is all there is too it.
For more details, you can view this demonstration.
Comments ( 0 )
Sign in to join the discussion.