# Getting a UDT binding value

**URL:** <https://forum.inductiveautomation.com/t/getting-a-udt-binding-value/40322>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [November 4, 2020, 11:55pm UTC](https://forum.inductiveautomation.com/t/getting-a-udt-binding-value/40322 "2020-11-04T23:55:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tmahaffey](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tmahaffey/32/30949_2.png) [@tmahaffey](https://forum.inductiveautomation.com/u/tmahaffey)\
**Post date:** [November 4, 2020, 11:55pm UTC](https://forum.inductiveautomation.com/t/getting-a-udt-binding-value/40322/1 "2020-11-04T23:55:55Z")

</div>

Im using system.tag.getConfiguration(tag)[0][‘opcItemPath’]  
We are using a lot of UDT instances with UDT parameter bindings. When I get the configuration for the opc item path, it returns these bindings in this format:

{bindType=parameter, binding={myParam}.“the Rest of the path defined in UDT definition”}

when I try to pull out the value of the binding by using something like print config[‘opcItemPath’][‘binding’], I am met with this error:

Traceback (most recent call last):  
File “”, line 11, in   
TypeError: ‘com.inductiveautomation.ignition.common.config.BoundValue’ object is unsubscriptable

So, i’m resorting to using string splits to access the bound value which feels like such a workaround. Isn’t there a better way?

---

<div class="post-metadata">

**Author:** ![tmahaffey](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tmahaffey/32/30949_2.png) [@tmahaffey](https://forum.inductiveautomation.com/u/tmahaffey)\
**Post date:** [November 16, 2020, 8:53pm UTC](https://forum.inductiveautomation.com/t/getting-a-udt-binding-value/40322/2 "2020-11-16T20:53:40Z")

</div>

Still finding the object to be unsubscriptable when I try and get to the value of some binding of a udt instance.

```auto
	cfg = system.tag.getConfiguration(tag)[0]
	print cfg['parameters']['Comm_name']
	print cfg['parameters']['Comm_name']['value']

```

Printed results are:

```auto
>>> 
{datatype=String, value=ACOSTA1_RTU}
Traceback (most recent call last):
  File "<input>", line 8, in <module>
TypeError: 'com.inductiveautomation.ignition.common.tags.config.properties.ParameterValue' object is unsubscriptable
>>> 

```

---

<div class="post-metadata">

**Author:** ![jburgess](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@jburgess](https://forum.inductiveautomation.com/u/jburgess)\
**Post date:** [November 30, 2020, 11:37pm UTC](https://forum.inductiveautomation.com/t/getting-a-udt-binding-value/40322/3 "2020-11-30T23:37:47Z")

</div>

I’ve got exactly the same problem today. Did you ever find a better solution than parsing the string?

---

<div class="post-metadata">

**Author:** ![tmahaffey](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tmahaffey/32/30949_2.png) [@tmahaffey](https://forum.inductiveautomation.com/u/tmahaffey)\
**Post date:** [November 30, 2020, 11:52pm UTC](https://forum.inductiveautomation.com/t/getting-a-udt-binding-value/40322/4 "2020-11-30T23:52:29Z")

</div>

Unfortunately it’s been crickets. Kind of a hassle to get a simple tag config parameter. Hopefully someone chimes in here and shows us the way!

---

<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:** [December 1, 2020, 12:43am UTC](https://forum.inductiveautomation.com/t/getting-a-udt-binding-value/40322/5 "2020-12-01T00:43:34Z")

</div>

> [@tmahaffey](#):
>
> print config[‘opcItemPath’]

`print config['opcItemPath'].getBinding()` or `print config['opcItemPath'].binding` should work - the latter is Jython syntactic sugar for the former.

---

<div class="post-metadata">

**Author:** ![jsteward](https://avatars.discourse-cdn.com/v4/letter/j/8e7dd6/32.png) [@jsteward](https://forum.inductiveautomation.com/u/jsteward)\
**Post date:** [November 17, 2021, 5:38pm UTC](https://forum.inductiveautomation.com/t/getting-a-udt-binding-value/40322/6 "2021-11-17T17:38:07Z")

</div>

I was recently trying to search for answer to this same question. I reached out to support and they gave me some info from the SDK documentation which provides the answer.

```auto

tags = system.tag.getConfiguration("[default]_types_/", True)
#print tags

for tag in tags:
	tagConfigs = tag
	#print tagConfigs
	for key,value in tagConfigs.iteritems():
		#This is all of the tags in the _types_ folder
		#More specifically, this is a list of configurations for each of the tags in this folder
		if key == 'tags':
			tagConfigList = value
			#print type(tagConfigList)
			#Becuase it's a list we must loop for each item in the list
			for tag in tagConfigList:
				tagConfig = tag
				#Now, we get an actual dictionary of configurations for each tag
				print "UDT Configs:"
				for key,value in tagConfig.iteritems():
					#These are all the properties (or keys) for the UDT
					print "KEY:",key,"| VALUE:",value
					#Parameters seems to have another dictionary for its value
					if key == 'parameters':
						
						parameterValueDict = value
						print "--------------------------------------------"
						print "Parameter Value Dictionary = ",parameterValueDict 
						#This is a dictionary type so I will get the key,value pair again
						for key,value in parameterValueDict.iteritems():
							print key,value
							#This seems to have another dictionary as its value
							print type(value)
							#But it's not a dict type
							#It's a com.inductiveautomation.ignition.common.tags.config.properties.ParameterValue type!
							#So we cannot use iteritems again
							parameterValue = value
							#But we can use this method from the java docs to easily get the type of the parameter
							print "This Parameter is a:", parameterValue.getDatatype()
							print "This Parameter's value is: ", parameterValue.getValue()

```

Also if value is of the type \<type ‘com.inductiveautomation.ignition.common.config.BoundValue’\>  
e.g. value={bindType=parameter, binding={InstanceName}}  
then you can use

```auto
value.getValue().getBinding() 
value.getValue().getBindType()

```

> **Summary**
>
> This text will be hidden
