Convert a Numeric Value to Decimal Format the Articulate Storyline Way
This blog detailshow to convert a numeric value to decimal format using Articulate Storyline.
Take a numeric data entry field. By default, a numeric variable named “NumericEntry” is created.
Create a text variable named “textvalue” and set the default value as empty.
Let’s now look at the purpose of each line of code.
var player=GetPlayer(); is for extracting the properties of the Player.
varNumericEntry=NumericEntry.toFixed(3); is for fixing the decimal points. Here I’ve taken 3 decimal points.
vartxtvalue=NumericEntry.toString(); is for converting the numeric value to a string format.
player.SetVar(“textvalue”, txtvalue); is for passing the variable to Storyline.
Now display the value of the text variable (“textvalue”) by placing the text “textvalue” between two “%” symbols.
Publish your Storyline file and check the magical output.