# Get Last 2 digits of UDT Instance name, in a parameter?

**URL:** <https://forum.inductiveautomation.com/t/get-last-2-digits-of-udt-instance-name-in-a-parameter/41542>\
**Category:** Ignition\
**Created:** [December 15, 2020, 8:52pm UTC](https://forum.inductiveautomation.com/t/get-last-2-digits-of-udt-instance-name-in-a-parameter/41542 "2020-12-15T20:52:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheColonel26](https://avatars.discourse-cdn.com/v4/letter/t/ac8455/32.png) [@TheColonel26](https://forum.inductiveautomation.com/u/TheColonel26)\
**Post date:** [December 15, 2020, 8:52pm UTC](https://forum.inductiveautomation.com/t/get-last-2-digits-of-udt-instance-name-in-a-parameter/41542/1 "2020-12-15T20:52:18Z")

</div>

See screenshot

How can I get the 00 or 01 etc from the Step Tag name and set it as the value of the parameter Step\_Element  
I also need to format it to remove the 0 paddings. so 1 digit numbers are only one digit.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/e/2e20607a985438ac8bfa7d45dc68602ac4071b92.png)

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [December 15, 2020, 9:09pm UTC](https://forum.inductiveautomation.com/t/get-last-2-digits-of-udt-instance-name-in-a-parameter/41542/2 "2020-12-15T21:09:31Z")

</div>

I’m not sure you can. Typically you would do this the other way around. You would setup your parameter, then use the parameter to create your UDT instance name.

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [December 15, 2020, 10:23pm UTC](https://forum.inductiveautomation.com/t/get-last-2-digits-of-udt-instance-name-in-a-parameter/41542/3 "2020-12-15T22:23:27Z")

</div>

Depending on your setup you might be able to make an expression tag and use the {InstanceName} parameter and [https://docs.inductiveautomation.com/display/DOC80/substring](https://docs.inductiveautomation.com/display/DOC80/substring).

That doesn’t give it to you as a parameter, but it would let you access the value if you need it for something else.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [December 16, 2020, 2:08pm UTC](https://forum.inductiveautomation.com/t/get-last-2-digits-of-udt-instance-name-in-a-parameter/41542/4 "2020-12-16T14:08:11Z")

</div>

You could create a memory expression tag in the UDT and do something like

`toInt(split(toStr({InstanceName}),'_')[1,0])`

---

<div class="post-metadata">

**Author:** ![TheColonel26](https://avatars.discourse-cdn.com/v4/letter/t/ac8455/32.png) [@TheColonel26](https://forum.inductiveautomation.com/u/TheColonel26)\
**Post date:** [December 17, 2020, 4:06am UTC](https://forum.inductiveautomation.com/t/get-last-2-digits-of-udt-instance-name-in-a-parameter/41542/5 "2020-12-17T04:06:42Z")

</div>

ok, I have created a Memory Tag called “Index\_OnPLC” and I am getting the right value in it. but how do I get the value into a parameter?

I have tried {[.]Index\_OnPLC} and {Index\_OnPLC}

ORRRR a different approach How can I automatically add 200 copies of a UDT type in to parent UDT definition, and just increment the parameter value without having do it manually 200 times?

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [December 17, 2020, 12:52pm UTC](https://forum.inductiveautomation.com/t/get-last-2-digits-of-udt-instance-name-in-a-parameter/41542/6 "2020-12-17T12:52:32Z")

</div>

You could write a tag change script on one of the tags that then writes back to the UDT instance and sets the parameter.

For bulk operations I have scripted tables that will create the tags.

Your best bet for a quick bulk creation is to create a few instances, select them, right click, export to XML.  
Edit the XML and duplicate the lines for the tags and then just change the values.  
Go back to the tag browser, right click, import, and import the modified XML.
