# Custom non-standard number formating

**URL:** <https://forum.inductiveautomation.com/t/custom-non-standard-number-formating/17428>\
**Category:** Ignition\
**Created:** [March 20, 2018, 12:38am UTC](https://forum.inductiveautomation.com/t/custom-non-standard-number-formating/17428 "2018-03-20T00:38:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmason](https://avatars.discourse-cdn.com/v4/letter/c/9e8a1a/32.png) [@cmason](https://forum.inductiveautomation.com/u/cmason)\
**Post date:** [March 20, 2018, 12:38am UTC](https://forum.inductiveautomation.com/t/custom-non-standard-number-formating/17428/1 "2018-03-20T00:38:11Z")

</div>

I’m trying to format a number so that it is padded with 0’s to always show 9 digits. eg 10045 = 000010045 but with commas in specific places.

Getting the padding is fine, but the format property of the numeric label doesn’t follow my comma layout.

For example I’m using the format #00,0000,000 where (right to left) the first three digits represent one group, the next four represent another, and the last two represent another, all separated by the commas.

However even with the above mask the display defaults to 000,000,000 where there is a comma every three digits.

Am I setting the wrong mask or am I going to have to turn the number into a string and format it manually and display it as text?

---

<div class="post-metadata">

**Author:** ![bfuson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bfuson/32/4597_2.png) [@bfuson](https://forum.inductiveautomation.com/u/bfuson)\
**Post date:** [March 20, 2018, 8:13pm UTC](https://forum.inductiveautomation.com/t/custom-non-standard-number-formating/17428/2 "2018-03-20T20:13:14Z")

</div>

If the pattern system used by the PMINumericLabel and PMIFormattedTextField components is anything like Java’s DecimalFormat, then I don’t think this is possible.

In DecimalFormat, you can set the grouping size (how many numbers between commas) but it has to be consistent:  
[https://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html](https://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html)

Thankfully this isn’t so bad to script yourself:

```auto
n = str(4) # convert number to string
n = n.zfill(9) # pad to 9 zeros
n = n[:2] + ',' + n[2:6] + ',' + n[6:]	# insert custom grouping seperators

```
