# Udt button template not write the value

**URL:** <https://forum.inductiveautomation.com/t/udt-button-template-not-write-the-value/78326>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [August 24, 2023, 10:57am UTC](https://forum.inductiveautomation.com/t/udt-button-template-not-write-the-value/78326 "2023-08-24T10:57:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![govind](https://avatars.discourse-cdn.com/v4/letter/g/ac91a4/32.png) [@govind](https://forum.inductiveautomation.com/u/govind)\
**Post date:** [August 24, 2023, 10:57am UTC](https://forum.inductiveautomation.com/t/udt-button-template-not-write-the-value/78326/1 "2023-08-24T10:57:59Z")

</div>

Hello friends,

I have faced the problem while using UDT with a template.

valve on/off button not working.

I created valve UDT and configured tags.

Created a new template with using valve UDT.(template pictures attached for your reference.)

I defined property in every object.

I also tried using through popup window, but it's worked for only one valve.

**Note** : need to operate each valve using the template.(total num. of 10 valves)

 ![on button script](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/e/ceb24e4a8233271009edaa9fd5c6c8bca4eed98e.png)  
 ![valve status](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/2/d24e96950c3b901e4005f3365dc649070d09f32c.png)  
 ![valve template](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/4/448b870897b6cb9da3681f11559f8453b745a991.png)  
 ![valve UDT](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/6/76fef897e1e0b156d52752dc1ad4400f5e85d3a9.png)

---

<div class="post-metadata">

**Author:** ![m.pelagatti](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/m.pelagatti/32/68595_2.png) [@m.pelagatti](https://forum.inductiveautomation.com/u/m.pelagatti)\
**Post date:** [August 24, 2023, 11:40am UTC](https://forum.inductiveautomation.com/t/udt-button-template-not-write-the-value/78326/2 "2023-08-24T11:40:50Z")

</div>

You need to write directly to event.source.parent.valveNum.on off property, not use writeBlocking...

---

<div class="post-metadata">

**Author:** ![govind](https://avatars.discourse-cdn.com/v4/letter/g/ac91a4/32.png) [@govind](https://forum.inductiveautomation.com/u/govind)\
**Post date:** [August 25, 2023, 4:25am UTC](https://forum.inductiveautomation.com/t/udt-button-template-not-write-the-value/78326/3 "2023-08-25T04:25:41Z")

</div>

Hello dear,

I tried as per mentioned you, but still has not worked.

I used 'event.source.parent.valveNum.on off script instead of the writeblocking script.

Is any additional expression required for further function.?

PFA script pictures for your reference.

 ![template button script](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/6/d63995ab0fd1c081abec4afabd1ea2240382bcc3.png)

---

<div class="post-metadata">

**Author:** ![m.pelagatti](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/m.pelagatti/32/68595_2.png) [@m.pelagatti](https://forum.inductiveautomation.com/u/m.pelagatti)\
**Post date:** [August 25, 2023, 5:17am UTC](https://forum.inductiveautomation.com/t/udt-button-template-not-write-the-value/78326/4 "2023-08-25T05:17:24Z")

</div>

> [@govind](#):
>
> event.source.parent.valveNum.on off

You need to write without "" :

```auto
event.source.parent.valveNum.on off = 1

```

To help you, use Choose Property button for auto compile code , click directly to property for autocompile string property.

---

<div class="post-metadata">

**Author:** ![govind](https://avatars.discourse-cdn.com/v4/letter/g/ac91a4/32.png) [@govind](https://forum.inductiveautomation.com/u/govind)\
**Post date:** [August 25, 2023, 6:09am UTC](https://forum.inductiveautomation.com/t/udt-button-template-not-write-the-value/78326/5 "2023-08-25T06:09:03Z")

</div>

I tried this script.(event.source.parent.valveNum.on off = 1)

But it's not worked.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [August 25, 2023, 6:24am UTC](https://forum.inductiveautomation.com/t/udt-button-template-not-write-the-value/78326/6 "2023-08-25T06:24:55Z")

</div>

That space between on and off in your naming convention isn't going to work for a jython syntax. I recommend changing your naming convention to eliminate that space from the attribute. Alternatively, you could try this:

```auto
setattr(event.source.parent.valveNum, 'on off', True)

```

---

<div class="post-metadata">

**Author:** ![govind](https://avatars.discourse-cdn.com/v4/letter/g/ac91a4/32.png) [@govind](https://forum.inductiveautomation.com/u/govind)\
**Post date:** [August 25, 2023, 6:50am UTC](https://forum.inductiveautomation.com/t/udt-button-template-not-write-the-value/78326/7 "2023-08-25T06:50:53Z")

</div>

Thanks,

It's working.

I have one more question about the pop-up window.

Can I use one popup window for the multiple valve operation.?(using template and UDT)

For example:

created valve UDT for multiple valve operation, and also created valve operation master template.

I defined UDT datatypes in a master template, if I click one valve component then the valve operation window pops up.

So, can I use multiple valve component operation using only one popup window.?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [August 25, 2023, 7:15am UTC](https://forum.inductiveautomation.com/t/udt-button-template-not-write-the-value/78326/8 "2023-08-25T07:15:31Z")

</div>

> [@govind](#):
>
> can I use multiple valve component operation using only one popup window

This is the only way I would do it, but I don't know about UDT custom properties. I could be wrong, but something about it doesn't sound appropriate to me.

Study this tutorial I created for using popups in the way you are describing, and see if this approach would be a better fit for your usage case:

> [@Use only one window for different components values](https://forum.inductiveautomation.com/t/use-only-one-window-for-different-components-values/68062/8):
>
> I'm sure you've figured this out by now, but just in case, I've put together a tutorial that is specific to your usage case: Here is a popup window with 5 numeric text fields: [image] I have a list of tags that are going to be sent to the popup from various buttons, and will subsequently provide the values: [image] These are my buttons that are in a main window: [image] The 1st thing to do is right click on the root container of the popup window and select Customizers--\>Custom Properties: …
