Udt button template not write the value

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)



valve template
valve UDT

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

1 Like

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.

You need to write without "" :

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.

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

But it's not worked.

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:

setattr(event.source.parent.valveNum, 'on off', True)
2 Likes

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.?

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: