Perspective Expression Binding for indirect values in a UDT

(This is in 8.1.15 under Linux)

I have a UDT with a structure partially like:

UDTName
  |
  |--Folder1
  |       |
  |       +-Value1 (bool)
  |
  |--Folder2
          |
          +-Value2 (bool)

I’ve created a Perspective Embedded View that is a drop target for instances of this UDT, and linked the path of the instance to a view parameter called “TagPath”.

Using this configuration I have an object in the view that I can control the visibility of using Value1 via an Indirect Tag Binding:

Tag_Indirect

But what I want to do is to control the visibility of comparing Value1 with Value2, EG the the result of the binding should the boolean expression of Value1 != Value2.

However I have no idea how to achieve this. I have tried various combinations of Tag/Expression bindings and pure Expression bindings but I can’t make it work.

How do I create a binding that is a function of two fields that are both indirectly referenced from within the same UDT?

I’m not sure I understand, let’s see if I got this right:
You basically want to use two indirect tags. Is that correct ?

I don’t have ignition on this machine so I can’t try things right now, but a simple solution would be to have two custom properties with indirect tag bindings, and compare those properties.

1 Like

Basically I want the result of the binding to be:

{view.params.TagPath}/Folder1/Value1 != {view.params.TagPath}/Folder1/Value1

But I don’t know how to achieve that

Create two custom properties.

view.custom.value1 & view.custom.value2

Use an indirect tag binding on each property to the correct value1 or value2.

Then for CheckMark_Missed.custom.Checked instead of a tag binding use an expression binding:

view.custom.value1 != view.custom.value2

So I have to jump through another level of indirection instead of referring to Value1 and Value2 directly?

Well, you could use the Tag() expression, but @pturmel will not be happy. :laughing:

Yeah, the extra indirection is needed in this case to achieve what you are attempting.

A tag binding can only resolve to 1 tag path and an expression binding cant have nested paths.

I suppose you could possibly use a script transform and manage to do it somehow that way, but really I think the indirection is the best option.

Expression tags are the only place I would use the tag() expression function. I wouldn’t be unhappy if peter resorts to that.

1 Like

Well isn’t there some unwritten rule about not upsetting @pturmel :rofl:

3 Likes

There isn’t, I was just referring to his general distaste for the use of the function.

Usually, it isn’t used in the correct places and thus results in unneeded overhead in the form of extra trips to the gateway. I try to avoid using it so I don’t use it where it shouldn’t be.

Either way, an expression binding like this may work:

tag({view.params.TagPath} + '/Folder1/Value1') != tag({view.params.TagPath} + '/Folder1/Value2')

If you’re using those values somewhere else, you might as well have them as properties instead of reading them each time. Even if the reads are cached, I find it simpler to have a single property to reference.

That’s a good idea. I am using them individually so it makes sense to have a single point of truth for each of them