How to map OPC UDT to Ignition template


I created a Widgets template and some instance of this widgets groups,
want to map the OPC UDT tags to these instance of widget groups.

Is there any way that we can mapping the content of OPC UDT tags to the Widgets template automatically?

The OPC UDT tag has a value with “Documentation” datatype.
its content like {“Button 1”:“Open”, “Button 2”:“Close”}

For myself defined widget template, there are 2 buttons (Button1, Button2). I want to map the status of Button 1 & 2 of OPC UDT tag to the Button1 & Button2.

So How could I parse {“Button 1”:“Open”, “Button 2”:“Close”} in the Widgets template?

I have search a below document link

It can map data elements with float/string type as shown in below example snapshot, but there is no comments to map the “Documentation” type. So how could I parse the “Documentation” type and map its “Button 1” and “Button 2” to two different buttons separately?

It might be easier if you turn these into Ignition UDTs using the strategy outlined in this post: OPC UA struct data type?

You might also be able to skip that and use jsonGet and jsonSet from your template bindings. But it wouldn’t happen automatically.

Thanks for your quick comments.

Do you mean to create a UDT manually with two elements: Button 1 and Button 2 and then parse the OPC UDT tag with JsonGet function and fill the Button 1 and Button 2 in the manually created UDT ?

If Yes, In fact, I don’t like to use this way because our real UDT is nested UDT and has a lot of struct members, so we don’t want to use that way.

So I just drag the OPC tag into Tags directory of Ingition to create UDT data type in Ignition directly. With this way, the newly created OPC UDT in Ingition has same data structure as OPC tag.
For the newly UDT tag in ignition, Its values is also json format like {“Button 1”:“Open”, “Button 2”:“Close”} with Documentation type.

I knew that we could manually map each UI widgets for Ignition UDT tags, but it’s time consuming.

So Is there anyway that the widgets template can parse the json data of Ignition UDT tags automatically by some setting or function call?

BTW, we had tried to use JsonGet function in the widget template,
The JsonGet function could only parse the json content of an instanced UDT tags.
We could link the naming of instanced UDT tags to the Instance Name of Widget Template.

Does it support to use variable (instead of an instanced tag name) such as Instance Name of Widget Template in JsonGet function?

If you need to make a dynamic tag lookup, you can either use an additional custom property (with an indirect tag binding) or the tag function.

Thanks for the suggestion.
I use additional custom property to pass the tag’s UDT content (Json data) to the widgets and it works

1 Like