Using Parameters in Perspective

I'm trying to create a template in Perspective (kind of like how they have templates in Vision) using embedded views. I'm trying to get it to where I can have my tag path change based on a parameter so that I don't have to go in and change every single expression whenever I add a new machine.

I want my paths to look something like this: tag("[default]" + {view.params.machine} + "/Inputs/Running")

I'm pretty sure the syntax of my path is correct based on what others have done on the forum. I think my error lies in how I'm setting up the parameter in my embedded view.

Avoid the tag function like the plague.

Use indirect tag bindings to achieve what you are trying to do.

Can’t help you more without screenshots or actual code, sorry!

1 Like

No problem! This is what I did in my embedded view:

and this is what I have in my component that I wanted to link the parameter to:

Is there anything else I should attach or any additional information? I’m still relatively a beginner at ignition so I might not be the best at explaining things.

I eventually want to get it to the point where I can replace all my tag paths for my expressions to do stuff like this:

Transform your expression binding into an indirect tag binding like so:

After doing that, hover over the result of the binding to see what the error could be (where it is written Bad_NotFound).

EDIT: To achieve what you are trying to do with your last screenshot, consider creating as many custom properties as needed, each of those custom properties should be an indirect tag binding.

1 Like

So I got the follow error: Error_InvalidPathSyntax(“Unable to build tag path, indirection reference(s)[machine] did not produce a value.”)

Don't use magic colors (hard coded color codes). Instead use style classes and/or css variables. That way when you need to change a color, you only have to do it in one place.

Show us a screenshot of what you did. Make sure you follow exactly what I did in my screenshot (it is not enough to write {machine} in the tagpath, you have to also specify where this data points to, in this case {view.params.machine})

Alright thats good advice, I had my backgroundColor property binded using this expression for my label to automatically change colors based on a status of my machine so I’ll look into that.

this is what I have

What is the value of the parameter view.params.machine

Have you defined the machine parameters on your view?

This should be done in the definition of the view

See my screenshot on my previous post, on the right hand side, I have defined the param machine

I thought I did, I’m going to assume that I did it wrong though. This is what I have:

Here you are embedding your view, you need to also define the params machine in your view definition.

You can use this small square to get to your view definition.

image

1 Like

That worked for me! Thank you!