Page 1 of 1

Formating numeric fields

Posted: Sun Jul 12, 2015 2:05 pm
by TonyS

I want the data that is stored in my database as float type to show as a float in the label that's mapped to it. Is this possible?


Formating numeric fields

Posted: Sun Jul 12, 2015 2:12 pm
by TonyS

Sorry I sorted it.

var tprice = value.parseFloat();
return tprice;

in the mapping:)


Formating numeric fields

Posted: Sun Jul 12, 2015 2:47 pm
by TonyS

Just an update anyone know why toFixed wont add trailing zeros?

so numbers show as 365.50 and not just 365.5


Formating numeric fields

Posted: Sun Jul 12, 2015 3:06 pm
by Illya Stepanov

Hi Tony -

You can pass the number of digits to appear after the decimal point into this method: code.toFixed([digits])/code

More info you can find here: https://developer.mozilla.org/en-US/d...


Formating numeric fields

Posted: Sun Jul 12, 2015 3:15 pm
by TonyS

Yeah I know but this doesn't work...

var tprice = value.parseFloat().toFixed(2);
return tprice;


Formating numeric fields

Posted: Sun Jul 12, 2015 3:15 pm
by TonyS

is it the parseFloat?


Formating numeric fields

Posted: Sun Jul 12, 2015 3:17 pm
by TonyS

Yep; it was the parseFloat:)