Nested paths in Perspective Bindings

I want to make a perspective binding where the value is the result of an expression that takes as input tag paths which themselves are constructed from perspective references. For example:

min(({{…/Dropdown.props.value}/SOME_TAG}+{{…/Dropdown.props.value}/SOME_OTHER_TAG}), {{…/Dropdown.props.value}/YET_ANOTHER_TAG})

This yields an error about not permitting nested paths, is there another way to do what I am trying to do here? Specifically, perform some calculation (binding expression) based on inputs from multiple tags where their paths are constructed from a perspective component’s value.

You need to use the tag() function to make indirect tag references within the same expression; the curly-brace syntax for tag lookups doesn’t allow calculation and must get a literal path.

Thanks! So, something like this? tag({…/Dropdown.props.value}+"/SOME_TAG") This seems to work for me. Also, this bulletin board is adding a period to the dot dot path construct in the example.

Yep, you’ve got it exactly. Another option is to move the indirect tag reference to a separate custom parameter (where you can just use the Indirect Tag binding type) and then reference that custom parameter directly in your main expression. This is more efficient (because on the backend, the tag() function has to look up and fetch the value of the tag in question from scratch every time the expression evaluates), but has the downside of separating your logic out a bit, which can be a bit confusing to maintain over time.

Nah, having the indirect on a separate property is much easier to follow. As far as I'm concerned, use of the tag() expression function is always a mistake.

1 Like

Hah, as soon as I mentioned it in the first post I figured you’d show up to correct me :slight_smile:

1 Like