Perspective and UDTs Expression Binding

I have been working on a way to create a view similar to a template in Vision. The issue I am running into is how to create expression bindings on a component in my view. For Vision, you can create a parameter on the template to be bound to a UDT definition that turns into a property on the template. Expression binding can then be done by using the UDT properties on the template.

If({Machine Template.Machine_Number : : Visible}, True, False)

For Perspective, it seems that the only way to pass UDT parameters is by using view parameters with an embedded view or to indirect tag bind. The issue with that for expression binding is that I cannot use indirect tag binding syntax in a expression. I have also tried creating a view parameter that contains the tag path for the UDT instance I would like to use in the expression and that does not seem to work either.

Example of trying to indirect tag binding:
If({[default]Machine {Machine_Number}/Visible}, True,False)

Example of trying to use view parameter:
If({view.params.Tag_Path_Visible}, True, False)

Is there a way that I am not thinking of to create expression bindings for a component in a view for a UDT instance in perspective?

There are many and more ways to do this. In perspective you get access to Transforms that allow, and increase the amount of flexibility that you have with Ignition. This will not always work best in the expression format however, which is why they have given a number of alternative Transform methods.

If I understand your question, you are trying to create a view that will accept parts of the UDT but not the entire UDT? Why can’t you use an indirect tag binding Transform? Or are you trying to figure out how to pass the correct parameter to the view?

Yes, I am trying to pass a single tag from my UDT and create an expression binding on the component. The example I put is less complicated than the expression I am trying to create but I can’t get this simple expression binding to work. I have tried to use indirect tag binding transform and it did not work for me. For the transform, I configured it as an expression where {value} = to a view parameter and the tag binding is also an expression if({[default] Machine {value}/Visible}, True, False). The syntax seems to be wrong using this method.

I believe you need something like:

if(tag("[default] Machine " + {value} + “/Visible”), True, False)

Here was my test:

1 Like

That worked well to get an “indirect binding” in an expression. Thank you.
To clarify, in Perspective there is no way to pass a UDT Instance as a parameter, similar to a UDT Custom Property on a Vision window?

hello, I am wondering what is the “/Bool.value” part? thanks!

“…/Bool” was the name of the tag I used for my test, and I wanted to ensure that it evaluated the true/false value of the tag to show the extent of what you can do in Ignition. The ‘.value’ part of the code is not explicitly necessary for that use case, but it doesn’t hurt either.

You can pass a UDT instance as a parameter either as a binding or as a path string in perspective.

Hello Tyrel, I still get it not right, so I have a perspective view with a label component, i set up the parameter for that view, create dropConfig.udts.action as bind. my testing tag path is: [default]1/AMPS, my expression on the label component is:
if(tag("[default] 1 " + {view.params.key} + “/AMPS.value”), True, False)
i still got errors, could you please suggest me where i may get wrong? thanks!

What are the errors you’re getting?

What is the value in view.params.key?

There looks to be spaces in that string that don’t match what you’re saying your tag path is. If the final evaluated string does not match what the tag path of an actual tag is then the expression won’t evaluate.

In my example from above:

if(tag("[DowntimeTracking]Machine " + {view.params.test} + "/Bool.value"), True, False)

I believe my actual tag path was:

[DowntimeTracking]Machine 2/Bool 


view.params.test == 2

Hello Tyrel,
my tag is {[default]1/AMPS}
my key is view.params.key==test
my tag binding expression on Label component is:
if( tag("[default]1 " + {view.params.key} + “/AMPS.value” ), True, False)

Thank you

Does the tag

[default]1 test/AMPS


Hello, I am actually confused about the params now. what is that should be?
my tag is [default]motor1/AMPS.value}
my param is {view.params.key==motor1}
my tag binding expression is if(tag("[default]motor1" + {view.params.key} + “/AMPS.value”), True, False)

If the param value you are using is ‘motor1’ then you should use:

if(tag("[default]" + {view.params.key} + “/AMPS.value”), True, False)

If you were to set the param to ‘1’ then you would use:

if(tag("[default]motor" + {view.params.key} + “/AMPS.value”), True, False)

If you were to set the param to ‘motor’ then you would use:

if(tag("[default]" + {view.params.key} + “1/AMPS.value”), True, False)
1 Like

I got it works! Thanks for the help!