Forum Discussion
How to display 2-decimal places in variable calculations?
Hi Mel,
Using JavaScript, you can convert your numeric variable to a text value. This requires two variables in Storyline: one for the calculated results (a numeric variable) and one for the displayed results (a text variable). Here's some basic JavaScript that will do the trick:
var player=GetPlayer();
var numValue=player.GetVar("numValue");
var numValue=numValue.toFixed(2);
var txtValue=numValue.toString();
player.SetVar("txtValue", txtValue);
Attached is a very basic Storyline example (you need to publish this for it to work). Remember to create in your Storyline file any variables you'll be retrieving from Storyline or sending back to Storyline.
Also remember that JavaScript won't work in the Articulate Mobile Player app for iPads.
Hope that helps.