# ReadBlocking Entire UDT, How to Get Custom Tag Properties

**URL:** <https://forum.inductiveautomation.com/t/readblocking-entire-udt-how-to-get-custom-tag-properties/98938>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [November 21, 2024, 2:28pm UTC](https://forum.inductiveautomation.com/t/readblocking-entire-udt-how-to-get-custom-tag-properties/98938 "2024-11-21T14:28:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [November 21, 2024, 2:28pm UTC](https://forum.inductiveautomation.com/t/readblocking-entire-udt-how-to-get-custom-tag-properties/98938/1 "2024-11-21T14:28:25Z")

</div>

I have a UDT that I'm reading all members of via `system.tag.readBlocking()`.

I have a handful of tags with custom number properties that I've added ("i", "j").

When I read the entire UDT I don't have access to these properties. I am reading about 20 of these UDTs at a time. What's the best/most efficient way to go about getting these custom property values for each UDT?

First thing that comes to mind is to add a string member to the UDT that just contains the UDT's full path and use that to create the path to all of the custom properties and use a call to `system.tag.readBlocking()` to get these values for each UDT.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 21, 2024, 4:17pm UTC](https://forum.inductiveautomation.com/t/readblocking-entire-udt-how-to-get-custom-tag-properties/98938/2 "2024-11-21T16:17:35Z")

</div>

What do you mean by 'reading all members of'? How are you constructing the list of paths that comprise the UDT already?

I don't know if it will include the custom properties, but try reading `path/to/tag.jsonValues` - it'll return a document that describes all the sub-members of the UDT and their values.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [November 21, 2024, 4:33pm UTC](https://forum.inductiveautomation.com/t/readblocking-entire-udt-how-to-get-custom-tag-properties/98938/3 "2024-11-21T16:33:44Z")

</div>

I have the path to the UDT instance and I use `system.tag.readBlocking()` to read all of the tag values within the instance. I get a dictionary of values that I then parse out in Python. However, I also need the values of the custom props.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 21, 2024, 4:38pm UTC](https://forum.inductiveautomation.com/t/readblocking-entire-udt-how-to-get-custom-tag-properties/98938/4 "2024-11-21T16:38:04Z")

</div>

> [@amarks](#):
>
> to read all of the tag values within the instance

Right - my question is where is the list of all the tag values coming from? Couldn't you just add the custom property paths to that list?

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [November 21, 2024, 4:39pm UTC](https://forum.inductiveautomation.com/t/readblocking-entire-udt-how-to-get-custom-tag-properties/98938/5 "2024-11-21T16:39:51Z")

</div>

The only path in that list is the path to the root node of the UDT instance. I _could_ but that would break my use of the function that I'm using to return a specific subset of the UDT instance values.

In any case,

Luckily, I had already built a function `getIJmemberPaths()` in my scripting library, so I can just use that and then combine them into a dict. Might not be the most efficient, but at least I'm only calling `readBlocking` once and the function is already built.

```python
def getIJmemberVals(path):
	'''
		Get a dictionary of values for UDT IK=J members for the supplied UDT instance
		
		Args:
			path (string)	:	path to the UDT instance root node
			
		Returns:
			{path:val}	(dict) :	dictionary of paths and values for UDT IJ members
	'''
	ijPaths = getIJmemberPaths(path)
	
	ijVals = [qv.value for qv in system.tag.readBlocking(ijPaths)]
	
	return {ijPath.rsplit('/',1)[-1] : ijVal for ijPath, ijVal in zip(ijPaths, ijVals) if ijVal != -1}

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 21, 2024, 4:42pm UTC](https://forum.inductiveautomation.com/t/readblocking-entire-udt-how-to-get-custom-tag-properties/98938/6 "2024-11-21T16:42:16Z")

</div>

> [@amarks](#):
>
> `getIJmemberPaths`

So, is this function returning a hardcoded list? I feel like we're talking past each other. Where, _in code_, is "list of paths under UDT at $path" defined?

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [November 21, 2024, 4:46pm UTC](https://forum.inductiveautomation.com/t/readblocking-entire-udt-how-to-get-custom-tag-properties/98938/7 "2024-11-21T16:46:38Z")

</div>

Yes, the IJ member paths function returns a preset list.

It sounded like you were asking where the base UDT path(s) came from for the read that returns the dict of values.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 21, 2024, 5:07pm UTC](https://forum.inductiveautomation.com/t/readblocking-entire-udt-how-to-get-custom-tag-properties/98938/8 "2024-11-21T17:07:58Z")

</div>

There's probably some internal node you can read that returns all the custom properties under a given path, but a quick search through the highly abstract tag code didn't reveal it to me. I would say the simplest, most pragmatic thing to do would be to add optional parameter(s) to your `getIJmemberVals` function that allows you to pass in 'extra' member paths to read, so you can just call `getIJmemberVals("path/to/tag", customProperties = ["i", "j"])` or something similar.

Not the best, not the worst 🤷‍♂️
