Bind a UDT instance to an embeded view by scripting

Hi,

I use an embedded view as a widget in my project. I create a folder that contains the tags for the view. All the view parameters are indirectly bound to objects in the embedded view based on a single parameter “Path.” I configure an event script on the main page to update the “Path” parameter when a user selects an object.

udt1

The event script updates the “Path” parameter to load values from another folder.

self.getSibling(“Transmitter Control”).props.params.Path=’[default]SJH 121/Level/S121’

It works, but makes modifications time consuming. I reorganized my tags in a UDT and modified the view to bind to an instance of the UDT, however, I can no longer bind the view to an instance of the UDT by scripting.

The script fails to bind the view parameter to the UDT instance.

self.getSibling(“Transmitter Control”).props.params.UDT=’[default]SJH 121/Level/S121’

Instead of binding the path of the UDT instance to the view’s UDT, it creates a simple parameter of the type value and assigns the path.

I’m assuming the way to make this type of binding is different when scripting. How do I bind the UDT instance to the embedded view via scripting?

Thank you,
Ali

If you’re passing the instance path as parameter, you could make a custom prop that binds to the instance directly using that path.
What is your script doing ? Is the one you mentioned that changes the path when a user selected something ?

You screenshot shows your tag binding in mode “Direct”. Why are you not using “Indirect”?

I have multiple transmitter graphics on a page. When a user clicks on a particular transmitter, the script modifies the “Path” parameter of an embedded view that contains more detailed information about the transmitter. All other parameters of the embedded view are indirectly bound with the Path being the variable that selects the transmitter information to be displayed on the embedded view app. The embedded view with indirectly bound parameters works, but it’s not as clean as directly binding to a UDT instance.

The original way I set up the embedded view uses indirect mapping. The Path parameter is the variable part and the rest of the parameters use Path to indirectly bind to other tags. That setup works fine. I’m looking for the correct script syntax to bind a UDT instance to an embedded view. My guess is that the UDT is se tup like an object whereas the Path parameter is a single value.

Pass the path to your view, and use it in an indirect tag binding on a custom property.

This obviously shows errors here as I’m not gonna create an UDT just for the example, but that’s the idea.

I would not do scripting. Instead use a indirect tag, you can have a custom property you insert into said path. and pass property in from something.