Best way to make an Expression Tag point to one tag or another dinamically

Hi,

We have 2 versions of the same thing working OK. Which one do you think will perform best? We’ll have 1000 tags with the same logic executing on a single gateway.

  1. Using the tag() function and building the relative tagpath dynamically, based on another tag’s value

tag(concat("[.]…/PM", numberFormat({[.]SELECTOR}, “000”), “/VALUE”))

  1. Using the case() function and pointing to the corresponding tag (with {}), based on another tag’s value.

case({[.]SELECTOR},
1, {[.]…/PM001/VALUE},
2, {[.]…/PM002/VALUE},
3, {[.]…/PM003/VALUE},
0
)

Neither. Use an intermediate custom string property with an expression like:

numberFormat({[.]SELECTOR}, "000")

Then, on the target property, use indirect tag binding with an base expression like so:

[.]../PM{1}/VALUE

and the indirect {1} pointing to the custom string property.
You should never use the tag() expression function (it is for backwards compatibility). The case() expression would work, but I believe it evaluates all of its expressions, whether used or not. That can result in extra tag value traffic.

UPDATE: I just realized you want to do this with an expression tag. If you must, use your form #1. Or even better, don’t make expression tags. Just build the logic I’ve shown into your client app.