What’s more efficient and more performant for bindings:
Using an expression binding for example: toBoolean(tag('tag/path/' + {parameterX}))
Using an indirect tag binding and then applying an expression transform, e.g.:
a)tag indirect binding: tag/path/{1}, {1} => {parameterX}
b)expression transform: toBoolean({value})
I’ll channel my inner pturmel and say don’t use the tag function. It’s better to create an indirect binding. If you need more than one tag in an expression binding you’re better off creating indirect bindings on custom properties and using those instead.
There is great content in this thread, so I would like to extend the question a bit:
Given there is a Perspective label component intended to display a tag’s value
Given this label’s text property is bound to view.custom.tagValue through a Property binding
@pturmel Which type of binding is best regarding performance for the view.custom.tagValue property to accommodate a dynamic tag-path (if there is a difference):
Option 1: A Tag Binding using “Indirect”, such as {tagPath}+'/static/portion/of/path', where tagPath is a reference and the property is {view.params.tagPath}
Option 2: A Tag Binding using “Expression”, such as {view.params.tagPath}+'/static/portion/of/path'
Isn’t this the same question as my OP? Your option 2 wouldn’t work as you expect btw, it will literally just return a string with your tag path. If you want to actually read the tag path in the expression language you would need to use tag()
My bad
Oohh, I always forget that there’s that new tag binding option in 8. I thought you were talking about an expression binding itself. Awks now I’m intrigued as to the answer as well
All ‘tag’ binding types in Perspective are ultimately using the same code to create the binding, so there’s not really going to be any significant difference. I would use an indirect tag binding unless you specifically need the extra ‘power’ of an expression there.
I really don’t need the extra power of an expression but if there is only one property, then I prefer expressions over the indirect tag binding because it is quicker to implement a binding; the expression tag binding doesn’t need a middle-man reference variable.
This is where i tend to just use the old number-based method we were always forced to use pre-8. It’s far quicker to type and I don’t find adding a text description offers much since the most I’ve ever tried to reference out was 2, maybe 3 parts. If you’re doing more than that, then it should probably be moved out into a custom property so that you can reuse it multiple times without having to reference those same 3,4,5+ references everywhere you need them inside of indirect tag bindings:
There is a slight performance advantage to using a ‘middleman’ with an indirect binding. That is, it avoids setting up an expression context and executing it on every update of the binding.