Change number format

Hi everyone,
I am trying to change number format: starting from 1,000.34 I want to arrive to 1.000,34. Ignition does not allow me to do it. Why ?
Thank you.

Where are you trying to change the format – in a component, somewhere else? And is this in the Designer or Client?

Ignition does in fact let you change number formats. Some formats are from the locale you are using, and some are specified in the component or the tag’s metadata. If you can give us specifics of what you’re trying to do, we can walk you through how to change the format.

Thank you,
I am working into the designer. My country is Italy. But I do not know how to change the locale in order to substitute the number format I want. Have I to set a script like:

system.util.setLocale('it_IT')

on startup ?

I want to change the number format in a numeric label

Looks like we need to add some information about localizing numbers and dates to our docs. :\

The Numeric Label component does have a number format available, but luckily you don’t need to change that to do what you want to do. But for future knowledge, remember that all number format strings in Ignition use a period for the decimal separator and a comma for the thousands separator, no matter what the actual symbol is in your locale. (This comes from Java, not from Ignition). Java will translate this string and use the correct symbols for your locale in the Client and Designer Preview.

Even though your OS is (likely) in Italian, the Designer is in a US locale when it’s not in preview mode. However, you can easily preview in Italian by going to Project > Preview Language and choosing Italian. (You will need to have added Italian in the Translation Manager first, by going to Tools > Translation Manager). When you preview your project, the number should now have the correct format. (Dates should also automatically show correctly as well.) You will enter numbers the way you normally do in your OS’s locale, even when the designer is not in preview mode.

In the client, if all your users speak Italian, you may want to hide the locale selector and use your setLocale script to automatically choose Italian for them. If you want to have multiple locales available, then you can leave the default value of showing the locale selector automatically any time you have more than one locale defined in the Translation Manager.

1 Like

You are an angel. :prayer: