# Binding other tag to Enable in UDT

**URL:** <https://forum.inductiveautomation.com/t/binding-other-tag-to-enable-in-udt/97353>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [October 16, 2024, 10:27pm UTC](https://forum.inductiveautomation.com/t/binding-other-tag-to-enable-in-udt/97353 "2024-10-16T22:27:03Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![scadafan](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@scadafan](https://forum.inductiveautomation.com/u/scadafan)\
**Post date:** [October 16, 2024, 10:27pm UTC](https://forum.inductiveautomation.com/t/binding-other-tag-to-enable-in-udt/97353/1 "2024-10-16T22:27:03Z")

</div>

I have a UDT and I would like to bind the enable to a tag in that UDT. I can't figure out how to do it. I thought it was like this but that doesn't work.

 ![BindingTags](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/9/19a79bdb41f3d6b5400a94337aed5575c97fbbf6.png)

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [October 16, 2024, 10:48pm UTC](https://forum.inductiveautomation.com/t/binding-other-tag-to-enable-in-udt/97353/2 "2024-10-16T22:48:04Z")

</div>

I don't think you can access values from other members of the UDT (or other tags for that matter) in a binding on that property. I believe you only have access to UDT parameters there.

I'm struggling to find where in the documentation this is actually called out. I know that alarm properties on a tag can access values from other UDT members and tags.

If you right click on the binding icon for the property and select `edit`, the right side of the editor popup will show you what data you have access to.

What is the purpose of you enabling/disabling a tag off of what I assume is a machine status value? Can't you just hide the value of the tag in whatever interface you are making?

---

<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:** [October 16, 2024, 10:58pm UTC](https://forum.inductiveautomation.com/t/binding-other-tag-to-enable-in-udt/97353/3 "2024-10-16T22:58:12Z")

</div>

> [@ryan.white](#):
>
> I believe you only have access to UDT parameters there.

Correct, and only in UDTs. Configuration properties of tags are **not** eligible to receive live bound values. Alarm properties **can** have more complex bindings, but they **aren't** live. Those evaluate only when there's an event for the given alarm. (Which means a binding to an alarm enable can only turn it **off** --there won't be any more events for that alarm that could turn it back on.)

Only actual expression tags can have full-function bindings. Only scripted value changes on actual tag values can propagate them to tag configuration properties.

---

<div class="post-metadata">

**Author:** ![scadafan](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@scadafan](https://forum.inductiveautomation.com/u/scadafan)\
**Post date:** [October 16, 2024, 11:08pm UTC](https://forum.inductiveautomation.com/t/binding-other-tag-to-enable-in-udt/97353/4 "2024-10-16T23:08:09Z")

</div>

This is what I was afraid of. Basically whenever they take a machine down for maintenance or whatever. I need to disable the tags. For some reason it's affect the communication with Kepware causing me to miss information whenever a tag goes bad like that or not found

---

<div class="post-metadata">

**Author:** ![scadafan](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@scadafan](https://forum.inductiveautomation.com/u/scadafan)\
**Post date:** [October 16, 2024, 11:21pm UTC](https://forum.inductiveautomation.com/t/binding-other-tag-to-enable-in-udt/97353/5 "2024-10-16T23:21:05Z")

</div>

How could I dynamically disable a tag then?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 16, 2024, 11:30pm UTC](https://forum.inductiveautomation.com/t/binding-other-tag-to-enable-in-udt/97353/6 "2024-10-16T23:30:14Z")

</div>

Use a tag value change event instead to write to the UDT instance's `enabled` property

---

<div class="post-metadata">

**Author:** ![scadafan](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@scadafan](https://forum.inductiveautomation.com/u/scadafan)\
**Post date:** [October 16, 2024, 11:30pm UTC](https://forum.inductiveautomation.com/t/binding-other-tag-to-enable-in-udt/97353/7 "2024-10-16T23:30:40Z")

</div>

Oh how would I do that? Do you have an example of this?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 16, 2024, 11:35pm UTC](https://forum.inductiveautomation.com/t/binding-other-tag-to-enable-in-udt/97353/8 "2024-10-16T23:35:04Z")

</div>

On the "Status" tag, add a Value Change script with:

```python
udtInstanceTagPath = '/'.join(tagPath.split('/')[:-2]) # modify the "-2" to suit your UDT to get you back to the root UDT instance level
system.tag.writeAsync('{}.Enabled'.format(udtInstanceTagPath), currentValue.value)

```

---

<div class="post-metadata">

**Author:** ![scadafan](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@scadafan](https://forum.inductiveautomation.com/u/scadafan)\
**Post date:** [October 16, 2024, 11:37pm UTC](https://forum.inductiveautomation.com/t/binding-other-tag-to-enable-in-udt/97353/9 "2024-10-16T23:37:36Z")

</div>

Sorry just a little confused how does this script work?

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [October 16, 2024, 11:42pm UTC](https://forum.inductiveautomation.com/t/binding-other-tag-to-enable-in-udt/97353/10 "2024-10-16T23:42:12Z")

</div>

It missing the comparison to determine if you need to enable or disable the tag in question, but when configuring the tag in the UDT, you should be able to right click the tag in the left window of the UDT editor and select `scripting` and then select ` valueChanged`, that's where you would place their script.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 16, 2024, 11:43pm UTC](https://forum.inductiveautomation.com/t/binding-other-tag-to-enable-in-udt/97353/11 "2024-10-16T23:43:03Z")

</div>

Ohhhh hang on... disabling the UDT Instance will also disable the tags within the UDT instance, so you actually won't be able to get it to re-enable if you rely on a tag within the UDT instance itself. You'll have to put this tag value change event on a tag outside of the UDT

> [@ryan.white](#):
>
> It missing the comparison to determine if you need to enable or disable the tag in question

It doesn't need it, it just uses the current value of the status tag (which seems to be a boolean)

But this is the config anyway in my UDT definition (again, note that this _will not be able to re-enable the UDT Instance!_):

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/9/79d16ea40c66c41292ea9e05553a0af552aa0a8f.png)

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [October 16, 2024, 11:47pm UTC](https://forum.inductiveautomation.com/t/binding-other-tag-to-enable-in-udt/97353/12 "2024-10-16T23:47:12Z")

</div>

> [@nminchin](#):
>
> which seems to be a boolean)

Ah, I was assuming status was a number like how typically pull status.

> [@nminchin](#):
>
> You'll have to put this tag value change event on a tag outside of the UDT

Can't they put this on the status tag and just write to the the enabled property of the UDT member? Or is that not a thing? As long as they are aware of the path to the tag in the UDT they can just build the path to the UDT member and only disable that member.

---

<div class="post-metadata">

**Author:** ![scadafan](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@scadafan](https://forum.inductiveautomation.com/u/scadafan)\
**Post date:** [October 16, 2024, 11:48pm UTC](https://forum.inductiveautomation.com/t/binding-other-tag-to-enable-in-udt/97353/13 "2024-10-16T23:48:15Z")

</div>

Ok yes this is what I was thinking. Ok I will give something like this a try. I was thinking more of disabling certain tags when this occurs. I think that should do the trick instead of the whole UDT

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 16, 2024, 11:49pm UTC](https://forum.inductiveautomation.com/t/binding-other-tag-to-enable-in-udt/97353/14 "2024-10-16T23:49:01Z")

</div>

> [@scadafan](#):
>
> I was thinking more of disabling certain tags when this occurs

Ok, that will work then 👍

In this case, use relative referencing in your tagpath:

```python
system.tag.writeAsync('[.]New Tag 1.Enabled', currentValue.value)
or 
system.tag.writeAsync('[.]../../New Tag 1.Enabled', currentValue.value) # go up 2 parent folders

```

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [October 16, 2024, 11:52pm UTC](https://forum.inductiveautomation.com/t/binding-other-tag-to-enable-in-udt/97353/15 "2024-10-16T23:52:07Z")

</div>

Keep in mind that if the tag you want to disable is marked as read only this will not work. Just confused myself with this by trying on a read only member of a UDT. Changing it off of read only allowed me to write to the UDT member's `enabled` property

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 16, 2024, 11:54pm UTC](https://forum.inductiveautomation.com/t/binding-other-tag-to-enable-in-udt/97353/16 "2024-10-16T23:54:43Z")

</div>

In that case, you'll need to use `system.tag.configure`, but be careful if you decide to use `system.tag.getConfiguration` to get the tags' config, as this will contain all of the non-default values from the UDT definition itself, not just the non-default values set on the UDT instance. If you write this back to the UDT instance, it will effectively solidify all of the non-default settings applied to the UDT definition, meaning any updates to those values won't come through into that instance.

Maybe i'll get you an example...

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 17, 2024, 12:02am UTC](https://forum.inductiveautomation.com/t/binding-other-tag-to-enable-in-udt/97353/17 "2024-10-17T00:02:04Z")

</div>

You can use this to disable a tag within a UDT instance if it's set to readOnly (you can use this for any tag if you want, even if it's set to read/write):

```python
system.tag.configure('[.]', tags=[{'name': 'New Tag 1', 'Enabled': currentValue.value}], collisionPolicy='m')

```

or if the tag to disable is in a parent folder:

```python
system.tag.configure('[.]../', tags=[{'name': 'New Tag 1', 'Enabled': currentValue.value}], collisionPolicy='m')

```

**ENSURE THAT YOU USE collisionPolicy='m', OTHERWISE YOU COULD DELETE YOUR TAGS**

---

<div class="post-metadata">

**Author:** ![scadafan](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@scadafan](https://forum.inductiveautomation.com/u/scadafan)\
**Post date:** [October 17, 2024, 12:02am UTC](https://forum.inductiveautomation.com/t/binding-other-tag-to-enable-in-udt/97353/18 "2024-10-17T00:02:48Z")

</div>

That worked. Thank you!

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 17, 2024, 12:03am UTC](https://forum.inductiveautomation.com/t/binding-other-tag-to-enable-in-udt/97353/19 "2024-10-17T00:03:46Z")

</div>

Just be careful to include the `collisionPolicy='m'` otherwise you could wipe out your tags... I edited above to include that warning for others
