Forum Discussion

KarenCote's avatar
KarenCote
Community Member
9 months ago

Rounding Off and Specifying Decimal Points to Display in Numeric Data Entry Fields

I would like to be able to restrict entries in a numeric data field to 2 decimal points. Also, when using numeric data fields for users to enter numbers which will be used to perform calculations, I would like the resulting answer to display at a selected number of decimal points by rounding off. This may be possible adding java script, but it would be great to have the option built into Storyline (round up, round down, no rounding, display only ___ decimal points). Does anyone have any work-arounds?

  • Restricting to a certain number of points needs to be done with Javascript, inputting each character individually. I'm sure I have seen some suggestions for doing that here on the forum. As for rounding and displaying, that's a two-step activity. You first have to take the number into JS, and manipulate it. Then you return it to SL and display it. The problem (and the benefit that makes it work) is that when JS returns it , SL thinks it is a text. It has to be put into a text variable, but at least it isn't subject to SL's policies for displaying numbers. Then if you want to perform further calculations, you have to use the original variable, and repeat the process to display it.

  • KarenCote's avatar
    KarenCote
    Community Member

    Thanks for the reply Walt. I ended up creating the calculator I needed in Excel and adding into the Resources of the course. I hope eventually there are more options built into Storyline.