numberFormat() not display decimals

Hi,
I’m in Ignition 8.1.12.
Expression below not works I don’t know why. Result must be 13.8.
image
image

try toFloat() instead.
https://docs.inductiveautomation.com/display/DOC79/toFloat

No changes. Result still 13 instead of 13.8

Maybe round is what you are after,
https://docs.inductiveautomation.com/display/DOC81/round

I think you’ve got the right function, just the wrong format string. Try #,##0.0, e.g.
2021-12-09 at 9.47 AM

Reference: Data Type Formatting Reference - Number Format

1 Like

With “#,##0.0” result is 13.0.
Curious
image

:exploding_head:
image

It works in python script. Is there a solution in python to do same format like “#,##0.##” ?

What if you just return {value} ?

What are the settings under Project->Project Properties and Perspective->General? Do you have a Project Locale specified?

You could use

"{n:1f}.format(n=value)"

What is exactly the output format you want ?

Project Locale is Browser.

With just {value} output is the same as input var type is string.

I’m confused. Does the bare numberFormat({value}) (without toFloat) not work for you?
What’s the actual type of this value (try the typeOf expression function)? It sure looks like a floating point to start.

Wait, what ?
Is your input property a string, or is the output a string ?

input is a string,
and the result is displayed in a label text so output should be a string.
image
image

Did you try a Format transform?

Same problem. :sob:

Can you try doing it on another input and see if you get the same results ?
Maybe make a custom prop and bind it to toString(13.81235124), then try applying the same process to this one.

Is numberFormat supposed to obey the locale? Yours appears to have put a , in instead of a . but I can’t get it to do that for me like the Format Transform can. Unfortunately with the Format Transform I can’t have dynamically set significant figures.