Hi Support,

I need to display a decimal only to 2 places after the comma or dot

How do i do it?

Thank you

Hi Support,

I need to display a decimal only to 2 places after the comma or dot

How do i do it?

Thank you

0 Likes

Hi Brian,

I’m assuming you’ve got a Decimal object (MyNumber1) with a value (i.e. 3.1474436)

Then you want to use it as a String with only 2 decimals.

In your String’s assignment, you can do the following expression:

= MyNumber1.ToString(“0.##”)

This will give “3.15”

Please let me know if this doesn’t work for you.

Regards,

Dawie

0 Likes

Thank you for the feedback Dawie.

What confused me here is that in the expression editor it does not give you the option of ToString then you type .(dot)

0 Likes

Also be aware of the difference between using # and 0:

“#” will output the digit of one exists.

“0” will output the digit of one exists and 0 if not.

e.g.

Where decimal = 1.2

0.## will output 1.2

0.0# will output 1.2

0.00 will output 1.20

0 Likes