Tag custom properties

Hi,

I am trying to add a custom property to a tag, in this custom property, I am going to get another tag’s value as the objectiveValue of this current tag. The steps are as follows, is it feasible or not? For me, it is not working. I need help. Thanks.

  1. create a tag
  2. add a custom property
  3. bind this cutom property to another tag
  4. how to remove a string part from a current tag’s path and add another string in expression: like tag({PathToTag}-“OEE Run/Availability”+"_Param/Objective OEE Avail")

Why would you not just create an expression tag to provide a modified version of the first tag?

I have several tags, each of these tags has an objective value, when we show these tags’ values, we need to compare with their objectives to bind color, so the easiest way for me is that each tag has a custom property refering to their objective tags.

I don’t see the advantage of creating another expression tag, maybe you can explain a bit more

You could try something like this:

tag(replace({[.]Availability.path}, "OEE Run/Availability", "_Param/Objective OEE Avail"))

Assuming that “Availability” is the expression tag the code above is going to exist in.

Edit: after re-reading your question, I’m not sure you are going to be able to add this expression to the custom property on the tag directly, if that is your intent.

I tried this expression and it didn’t work, even just with the expression replace({[.]Availability.path}, “OEE Run/Availability”, “_Param/Objective OEE Avail”), I cannot get an string out of this expression, it treat the expression as a string instead of a function, so does it mean the tag custom property can only be a constant value, it doesn’t make any sense.

Properties are just that. They don’t do anything on their own. You’re trying to make a UDT out of single tag, when you you should probably just make a UDT.

I thought the tag custom property can reference to another tag.

I am building on the existing tags’ structure, cannot modify a lot in the strucutre because it will affect a lot in the system, that’s why I thought of using a reference tag as a tag custom property. Just like creating a tag attribute in PI AF.

What are you binding the color on?

Color binding is the simple part, if tag.value > tag.Objective.value then color1 else color2. something like this.

Yes, but why can’t you just read the associated objective value in a script?

2 Likes

In fact, that is a good idea, maybe I can create a custom property, then assign the value in the script.

You could, but why would you? Just read the objective value directly, no need that I can see for a custom property.