Why shouldn't I use tag() in an expression

Why shouldn't I use tag() in an expression

Just to get you started down the rabbit hole.

EDIT: Another good reason:

4 Likes

I thought I read it somewhere but I couldn't find it. Thank you very much.

Ugh Configuring Indirect Tag Binding takes forever. Is there anyway to create them without going through the interface

I tend to use "Copy Binding" then "Paste Binding" then edit.

If your indirect binding always looks like:

{1}/SomeName

or

{1}/SomeName.SomeProperty

with {1} always pointing at {view.params.tagpath}, then making many of these is fairly easy.

4 Likes

So if tag() is so much trouble why is it even available as an option?

It is the only way to do indirection within expression tags, and the expression function registration system doesn't make a distinction about where the function could be used.

I would be in favor of tag() throwing a config error if used anywhere else.

A long, long time ago (in a galaxy far, far away) indirect tag bindings didn't exist, and tag() was the only method. It limps along for backwards compatibility reasons.

6 Likes

I would also be in favor of an error. I used it everywhere...Damnit

Or at least it could be helpful to have some more warnings/caveats in the docs. I used to use tag() everywhere all the time until @pturmel set me straight.
For example, add more warnings here:

1 Like

Don't tell us! Tell docs@inductiveautomation.com.