Expand my Community achievements bar.

toFixed() help

Avatar

Level 2

Hi all,

I have the following code and it seems to be breaking after the .toFixed().  The first message box will display a number but the second message box won't display anything at all.  Wondering if toFixed() doesn't work because labelvalue contains a string?


labelValue = String(monthObj.rawValue - lastMonthEle.rawValue);
   
xfa.host.messageBox(labelValue);
            LabelRounded = labelValue.toFixed(2);
xfa.host.messageBox(LabelRounded);

3 Replies

Avatar

Former Community Member

Hi,

toFixed does not work on String Values.

Regards--

Chalukya.

Avatar

Former Community Member

you can convert your textField data to Numeric data and then use toFixed();

var NumericValue = parseFloat( this.rawValue );
app.alert(NumericValue.toFixed());
this.rawValue = NumericValue.toFixed() ;

this.rawValue is my textField data.

Regards--

Chalukya