Generic in Expression Tag

In an Expression Tag, we could put something like this:

{[~]A/B0/C/D.AlertActive}

To get the Boolean value of the Alarm which is AlertActive in the tag with path {[~]A/B0/C/D.AlertActive}

Note that there is “B0” among the tag path. Now, I have identical tag paths, like that, except the number is different:

A/B0/C/D.AlertActive
A/B1/C/D.AlertActive
A/B2/C/D.AlertActive
A/B3/C/D.AlertActive

My question is, is there any way to make this generic is captured in the Expression Tag? Something like this:

{[~]A/B{1}/C/D.AlertActive}  then we refer {1} to anything we like.

As of now, I am trying to create Expression in the UDT tag itself. If it cannot be made generic, then I have to create unique expression for each Expression Tag instance instead of from UDT. :frowning:

If it is in a UDT then you just use Indirects for setting this up.
Here is an example one that we use in a UDT

[attachment=1]udt1.PNG[/attachment]

And then the tags under the UDT reference the variables from the UDT

[attachment=0]udt2.PNG[/attachment]

Tag paths can be made generic in expressions by using the “tag” expression function. Check out the documentation on “tag” to find out more: docs.inductiveautomation.com/display/DOC/tag

Best,

Hi nmudge,

Thanks for the reply. I actually have checked the short tag() documentation which you sent before I asked but still could not find work around with my case. :frowning:

The link shows that we can make use of Custom property like {Root Container.tankNum}.

In my case, the UDT is shown in a set of Components of a Template in a Template Repeater. The Template Repeater has a Repeat Behavior of Count and has Index Parameter Name “index”.

Now, the UDT I have contains some other base Tags and each base Tag is mapped to one Component in the Template, which is in the Template Repeater.

So, my question here is more like, from the base Tag in my UDT, how can I know the index in the Template Repeater it is actually referred to?

Hi MMaynardUSG,

Thanks. Your reply is pretty close in solving my issue actually. Except that I have multiple levels of tags which makes it rather hard except I copy over all the parameters to the children tags. :frowning:

I have tags with paths like:

A/B0/C/D
A/B1/C/D
A/B2/C/D
A/B3/C/D

Thus, I only need to put Number in my B tags as Data Type Parameter. However, I do not know how to access B Data Type Parameter from D. I could easily get D’s (assuming D is Expression Tag) Data Type Parameters in its Expression like this {Number}, but how to get C’s or B’s?

Since each C is another UDT owned by each B, I don’t know if we could get relative parent Parameters. I know that we could get our own custom parameters which are very useful indeed. But how to get the parent’s (or the parent’s parent’s). Is there a way to automatically pass down this custom parameter to all its children and its children’s children? Like inheritance protected concept in OOP like C# or Java I mean.

Any workaround? :frowning:

When you load a template into a template canvas or template repeater, the Parameters can be set as you load them. They are in a field called parameters, in a dataset called Templates which is a property of the canvas or repeater.

For example, here is a screenshot of a template canvas we use
The Parameter field passes all of the parameters for the template to the template.

[attachment=0]params.PNG[/attachment]

Thanks for the input @MMaynardUSG, will try that out.