Indirect Binding on custom property

Afternoon. I'm learning more and more about the nuances of Perspective and need some help understanding how to use indirect property references. Looking over past posts it looks like I needed to use the property expression function and can't make it work... recieving a 'Error_InvalidPathSyntax".

Here's an example of a simple test as suggested by others in earlier posts:

property({view.custom.test}+"1")



I recieve this error when binding to a Perspective label. I know there's something I'm misunderstanding here... can you folks help me? Thanks and let me know if you need more information!!

When you're using property, you (probably) don't want to use curly braces.

What you've currently got is doing things in this order:

  1. {view.custom.test} is evaluated as a direct property reference. You don't have a property with that name, so null is returned.
  2. null is concatenated with the literal string "1", which is either going to give you a resulting string "1" or just "null1" (not sure which off the top of my head).
  3. The literal string "1" is passed into the property function, which then tries to look it up as a property - which fails, because that's not a valid path.

What you probably want, in this simple case, is just:
property("view.custom.test" + "1"), assuming you're eventually intending on replacing the hardcoded 1 with a dynamic index.

That said, the whole thing sounds a bit like an XY problem. There are legitimate scenarios to use the property function, but they're few and far between, and you might be better off with an array type property with a known name.

Thank you for the reply. Perhaps I need to further explain the goal as I may be headed off in the complete wrong direction.

I have a collection of tag groups by individual machines... say Grinder1, Grinder2, Grinder3.

So..each tag collection may have tags for Operator, Machine, Part Number, etc. That all works as desired on various views.

I now need to set up individual flex containers to display current job data for each machine. What I thought I'd do is simply create a custom property for each flex container with the machine name (which could in turn references the appropriate custom property). In this way I simply change the machine custom property for each flex container. Do I need to use a flex repeater instead... or something else?


Well, if they're not already, I'd definitely say your Stand Grind (and related things) should be UDTs; they don't appear to be from your screenshot, but that's going to be a huge benefit to future productivity.

In any event, a generally good practice is to pass a "base" tag path as a parameter into your view. Then within the view, in custom parameters or wherever else appropriate, you can add indirect tag bindings - in this case, to something like {0}/Customer, {0}/PartNumber, where the indirect portion is a reference back to the view input parameter.

So in that way, you assemble a view that accepts a base tag path as an input parameter and is therefore suitable for any of your grinders, interchangeably.

Thank you once again. UDT's are a good idea... I should have thought of that. I'll get it implemented in V1.1 (-;.

I think what I'm stuck on is the parameter within the view. Probably just brain-freeze but here's an illustration:

In this case, I have a custom property on each view (named Machine1, Machine2, etc). I then use the indirect tag reference with the actual machine name entered (in the case, 'Stand Grind 1'). What hangs me up is the binding structure. As I've circled in the pic, this indirect binding refers specifically to each view...this is what I need to be dynamic.

Can't be that difficult so I'm probably just missing something. Any additional help is appreciated. As a user, the forum has been immensely helpful in my Perspective journey!

The forum, along with the (very patient) support folks, I've come from an SQL/PLC/Old school programming guy to be pretty efficient with Perspective and Python. Thanks!!

Yeah, I think the root of the problem is your component being named Machine1.

I don't know everything you've got going on in this view, but it seems like you need to add a layer of abstraction that you're currently missing.

One quick tip that won't address the root issue here but will help going forward: Try to elevate shared information (such as "what machine am I looking at") to the highest level container possible, and ensure all your inner components are always bound to that highest level. That way, if you need to rename an inner component, nothing else has to care - all the inner components are always pushing and pulling anything 'external' via that view.custom (or whatever) property.

I don't really understand exactly what your view is doing, and I'm also not the guy to help you architect a 'real' Perspective project, really - I just have some general tips I've picked up here and there. If you can describe your problem in more detail, someone more versed may be able to give a more holistic recommendation for how to reorganize things.

In your flex container, if you have a parameter named Machine that you're trying to use to pull in your indirect binding Grind Machine Stats Reference/{Machine}/Customer (are you trying to access the customer tag inside the "Stand Grind 1" folder?) that should be all you need. But if you're trying to reference a tag inside the "Stand Grind 1" folder to point to a different folder/tag structure elsewhere, you'll need to have another tag that also uses an indirect binding for those tags.

Thanks to you and Paul for pointing me in the right direction. This was an issue with placing the custom properties in the wrong place!!

Appreciate the help... I knew it was something done. What a difference a weekend makes!!

1 Like