How to do indirect tag references in expression tag

The screenshot below shows first code that works, and then commented out code for what I tried first to accomplish the same thing. The code that works is fine, except that it requires manual editing to scale (when more recipes are added), and it’s on the long side.

Reading help on indirect bindings, it appears that indirect binding within an expression should be possible. But I can’t seem to figure out how to enter an indirect binding to accomplish this without getting an evaluation error. Is there some way to do this? What am I missing?

1 Like

I don’t think you can do indirect referencing in an expression, but I may be wrong. What you can do though is create one or more custom properties on a root container or elsewhere, and set those for indirect references, then pull them into your expression.

1 Like

Something like

toStr(tag("[.]" + {[.]activeRecipeIndex} + "/name"))
12 Likes

Thanks Kyle! That (copy and paste of your code) makes sense and does exactly what I want. I like minimizing and simplifying external bindings required by programming more right into the type (or template, in other cases). Knowing how to do this will be useful as I build more UDTs and templates.

RRRancher, thanks for the tip. That’s another way to do the job, though if the relationship is something I can code internally I prefer that–glad to find out it can be done!

1 Like

Thanks Kyle, This was a great help.