Forum Discussion
decimal places in numeric variable
Hi William.
When ive had to do this sort of thing in the past, the Storyline number variable automatically defaults to two decimal places, so I use that instead of a numeric data entry text field.
Then simply use your buttons and a "Adjust Variable" trigger, to set the variable value correctly.
- WilliamRyan-dba6 months agoCommunity Member
I don't know what I'm missing. I add a numeric variable, and if I set the default value to "0.00", the variable stubbornly reverts to "0". The other interactions work as expected: the increase and decrease value by 0.25 correctly sets the decimal place, but when the number gets to a whole number, there are no decimal places.
- SteveGannon6 months agoCommunity Member
Hi William,
Storyline does not display trailing zeros. You can work around this with a bit of JavaScript (see attached). This involves sending the numeric value to JavaScript, having JavaScript round the value to two decimal places, convert it to a text value with the trailing zero (or zeroes), and then having JavaScript assign that to a text variable in Storyline. (Note: the custom text variable must already be created in Storyline before executing the JavaScript.)