Perspective - Flex container - Hierarchic meta.name

I’m on 8.1.15

I want to build a binding on a label by using the third level parent meta name, is there a way to acheive this ?
image

I want to get the “DCM_shot_id” meta.name from the “value”, I have tried {parent.parent.parent.meta.name} but it doesn’t work.

Anybody can help me with that ?

What are you trying to achieve?

I am having a hard time imagining why you would want to change the name of a container at runtime.

I can see how this could lead to many issues, such as breaking bindings.

I don’t want to change the name, I want to get the name to build a binding.

I want to dynamise some labels based on the top parent…

Ex.: label.text => DcmShotId <= That result comes from a functions that use as inputs “DCM_shot_id”, so I want to get meta.name of my hierarchic parent {parent.parent.parent.meta.name}

In perspective, traversing up the hierarchy can be a bit different and I find the best way is to use the property explorer.

For a property or expression binding, I believe that you’re looking for something like: ...../DCM_shot_id.meta.name

In script I think you would be looking for something like self.parent.parent.parent.parent.getChild("DCM_shot_id").meta.name

I know that, but I want to get it fully dynamically, I want to build a binding to not “hardcoded” the destination, I have no advantage to use it if I have to point the name that I want to get.

In scripting I can do something like this: self.parent.parent.parent.meta.name

I don’t think you can build a dynamic property name in an expression.

You could do it in a script transform if you have something else to bind to, or you could perhaps add an event script to the value

EDIT: Turns out there is an expression function.

https://docs.inductiveautomation.com/display/DOC81/property

property('this.someString' + {...../DCM_shot_id.meta.name})

https://docs.inductiveautomation.com/display/DOC81/property
You can in Perspective, actually :slight_smile:

I would have expected {parent.parent.parent.etc} to work, honestly.

EDIT: It looks like an intentional restriction that I don't see a way around. I'm not sure what technical limitations are implied; someone else may have more luck playing around with things:
https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.15/com/inductiveautomation/perspective/common/api/PropertyRef.html

1 Like

I’m unable to get it working correctly, can you provide me an example, i want to get the parent.parent.parent.meta.name

i suppose you can call a script in the expression too
https://docs.inductiveautomation.com/display/DOC81/runScript

it doesnt seem like you can chain "parent" n expressions for some reason

I finally opt for this solution
image

2 Likes