# UDT Definition: use custom property in OPC Item Path expression

**URL:** <https://forum.inductiveautomation.com/t/udt-definition-use-custom-property-in-opc-item-path-expression/95148>\
**Category:** Ignition\
**Created:** [August 26, 2024, 12:06pm UTC](https://forum.inductiveautomation.com/t/udt-definition-use-custom-property-in-opc-item-path-expression/95148 "2024-08-26T12:06:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robbe\_Meyvis](https://avatars.discourse-cdn.com/v4/letter/r/e68b1a/32.png) [@Robbe\_Meyvis](https://forum.inductiveautomation.com/u/Robbe_Meyvis)\
**Post date:** [August 26, 2024, 12:06pm UTC](https://forum.inductiveautomation.com/t/udt-definition-use-custom-property-in-opc-item-path-expression/95148/1 "2024-08-26T12:06:23Z")

</div>

Hi all!

I'm building an UDT with multiple tags pointing to OPC tags.  
I'd like to build the OPC Item Path but I'm struggling with using custom properties.

I'm trying to point to each "Tijd\_uren" in the sample below.  
There is a "Tijd\_uren" in every fase, which has an index.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/b/dbe86e3636966e15069168511a36c25bb140b9b5.png)

So I made an UDT with some properties, defining the length of each "Fase" etc to find the byte numbers.

But within each fase, I would have to say on which index we're looking...

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/0/801c82f2c66918533970a7721d32089338856188.png)

I could get it working, but I would have to go and modify all those indexes for each "Fase"...  
So, I would like to just copy the "Fase" folder and have a property "FaseIndex". So that's the only one I have to modify...

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/1/811be7a4fd9b68dc801e77e8be89b27ec27d7ddd.png)

And this is how I would like to use it:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/5/d51f2233215d5dd8f3ed6033e29af46fe643f9a7.jpeg)

```python
{PLC}DB{DBNr},I{DBStartByte+offsetStartFasenTovProgramma+(FaseIndex*LengteFase)+0}

```

It gives the following error:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/6/564b6794bd6f579db7099b330ee063237091f8ff.png)

The address should be:ns=1;s=[PLC\_Trommel1]DB20,I24

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

Any ideas on how to be able to use a variable "fase index" in the UDT?

Thanks!

---

<div class="post-metadata">

**Author:** ![Robbe\_Meyvis](https://avatars.discourse-cdn.com/v4/letter/r/e68b1a/32.png) [@Robbe\_Meyvis](https://forum.inductiveautomation.com/u/Robbe_Meyvis)\
**Post date:** [August 26, 2024, 1:28pm UTC](https://forum.inductiveautomation.com/t/udt-definition-use-custom-property-in-opc-item-path-expression/95148/2 "2024-08-26T13:28:46Z")

</div>

After some messing around, I managed to get it working as follows:

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

I just used the parameters from the parent UDT, in those Fase UDT's:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/9/19ea3869a038f7bdbcf548f989f740c19966e21d.jpeg)

I only have a FaseIndex parameter in the Fase UDT:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/1/c1c36dbdc5622a4b8d8a5de858eae3db757475ae.png)

Then I added some instances of Fase, to the Programma UDT and adjusted the FaseIndex parameter for each:

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

**NOTE: This is probably NOT the perfect way to do this?!**  
I noticed there is a Parent Data Type field which I'm not using.

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

Just posting it here, it might help someone.

Any pointers on the correct way to handle this are still appreciated!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 26, 2024, 1:49pm UTC](https://forum.inductiveautomation.com/t/udt-definition-use-custom-property-in-opc-item-path-expression/95148/3 "2024-08-26T13:49:59Z")

</div>

> [@Robbe\_Meyvis](#):
>
> I noticed there is a Parent Data Type field which I'm not using.

That is used when you have multiple similar data types that have some fraction of identical members. You can factor the common parts into a shared parent type, so that the variations only need their own unique parts.

---

<div class="post-metadata">

**Author:** ![Robbe\_Meyvis](https://avatars.discourse-cdn.com/v4/letter/r/e68b1a/32.png) [@Robbe\_Meyvis](https://forum.inductiveautomation.com/u/Robbe_Meyvis)\
**Post date:** [August 26, 2024, 1:57pm UTC](https://forum.inductiveautomation.com/t/udt-definition-use-custom-property-in-opc-item-path-expression/95148/4 "2024-08-26T13:57:31Z")

</div>

Ok, makes perfect sense!

So my approach was actually OK for this situation?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 26, 2024, 5:04pm UTC](https://forum.inductiveautomation.com/t/udt-definition-use-custom-property-in-opc-item-path-expression/95148/5 "2024-08-26T17:04:44Z")

</div>

I wouldn't make nested UDT just for your convenience incrementing addresses. You are adding runtime CPU load to avoid designtime human workload. Not always a good tradeoff. I'd try to identify what you need to programmatically generate your UDT json, so that it can be minimalist at actual instantiation.
