# Pass number/string with leading 0's as paramater

**URL:** <https://forum.inductiveautomation.com/t/pass-number-string-with-leading-0s-as-paramater/15574>\
**Category:** Ignition\
**Tags:** scripting, ignition79\
**Created:** [October 5, 2017, 12:22am UTC](https://forum.inductiveautomation.com/t/pass-number-string-with-leading-0s-as-paramater/15574 "2017-10-05T00:22:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stuart](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@Stuart](https://forum.inductiveautomation.com/u/Stuart)\
**Post date:** [October 5, 2017, 12:22am UTC](https://forum.inductiveautomation.com/t/pass-number-string-with-leading-0s-as-paramater/15574/1 "2017-10-05T00:22:46Z")

</div>

I have a value _002_ that I am trying to pass as a parameter (I’ll call it _pNum_) from page **A** to page **B** for use in an indirect tag path. I have tried a couple different things on page **B** but nothing has worked yet. If, on **B** I set my custom property _pNum_ as a String the value comes through as _2_. If I set the custom property to be an integer, same thing: _2_. If I add quotes to it, the String keeps the quotes and gives me “002”, and the Integer errors out - as expected.

The value will be used in an indirect tag path (_Alarms/p{1}/Alarm_) resulting in something that looks like _Alarms/p002/Alarm_ where {1} is the custom property _pNum_.

Am I missing something obvious?

Is there a way to remove quotes with an expression? I could use two custom properties, one would receive the value as _“002”_ and the other would read that value, strip off the quotes (_002_) and be used in my tag path.

Any suggestions would be appreciated.

---

<div class="post-metadata">

**Author:** ![cesrom](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@cesrom](https://forum.inductiveautomation.com/u/cesrom)\
**Post date:** [October 5, 2017, 12:46am UTC](https://forum.inductiveautomation.com/t/pass-number-string-with-leading-0s-as-paramater/15574/2 "2017-10-05T00:46:09Z")

</div>

Hello, Stuart.

Have you tried using _zfill(width)_?

> Pad a numeric string s on the left with zero digits until the given width is reached.

Example:

```auto
pNum = '2'
print pNum.zfill(3) -> '002'

```

Since the tag path is a string, you can easily concatenate the formatted pNum value.

I hope this helps.

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [October 5, 2017, 9:42am UTC](https://forum.inductiveautomation.com/t/pass-number-string-with-leading-0s-as-paramater/15574/3 "2017-10-05T09:42:23Z")

</div>

Are you using python scripts or expressions?

I’d guess it’s easiest to define a custom property on whatever UI element you want to use, and then make an expression for that property to get the string to use in the tagpath. For an expression, the best way is probably to use “numberformat” like this:

`"p" + numberFormat(5, "000")`

This will return the string “p005”.

---

<div class="post-metadata">

**Author:** ![bpeake](https://avatars.discourse-cdn.com/v4/letter/b/c0e974/32.png) [@bpeake](https://forum.inductiveautomation.com/u/bpeake)\
**Post date:** [February 8, 2021, 3:11pm UTC](https://forum.inductiveautomation.com/t/pass-number-string-with-leading-0s-as-paramater/15574/4 "2021-02-08T15:11:37Z")

</div>

Hi all,

Sorry to revive this dead post but I am having the same issue and am wondering if anyone has a solution. I am trying to pass a string parameter with values of 01, 02, 03 etc. The leading zero is always dropped once passed. As a result my indirect tagging fails because my tag names are EX01, EX02, SC22 etc.

---

<div class="post-metadata">

**Author:** ![bpeake](https://avatars.discourse-cdn.com/v4/letter/b/c0e974/32.png) [@bpeake](https://forum.inductiveautomation.com/u/bpeake)\
**Post date:** [February 8, 2021, 3:20pm UTC](https://forum.inductiveautomation.com/t/pass-number-string-with-leading-0s-as-paramater/15574/5 "2021-02-08T15:20:32Z")

</div>

Never mind! I spoke too soon and have figured it out.

Thank you to Sandnerd17 for the clue.

I created an expression binding on my custom property (that was holding the passed in value). I used numberFormat({Root Container._parameterName_},“00”) as the expression and the leading zero was added back.
