Bidirectional expression binding for Text Field?

I have a display showing PV and SP for 10 out of 1000 PID blocks. It displays correctly, but I want to change the SP of the tag. Since the format of my tags is “PDxxxx”, I use an expression binding using the index for the associated display element as shown. The problem is that unlike tag binding, expression binding does not provide a bidirectional ability in the Text Field component.

Is there a way to provide bidirectional SP change in this application?

1 Like

Don’t use the tag() expression function. (Like, never.) It exists for backwards compatibility. Use indirect tag binding instead, where all or part of the tag path is kept in a separate custom string property. Indirect tag bindings can be bidirectional.

4 Likes

Yudaman ptumel!

I don’t know if I chose the best way to do it, but here is what I did:

  • Created 10 integer tags (PDIndex) to hold the index of the PID loop
  • Created 10 expression tags (PDTag) to convert the 10 PDIndex tags to a string with the tag path to the PID SP tag
  • Created 10 custom properties (PDTag) of type string on the root of the window with a binding to the PDTags
  • Bound the Text Field components to the custom property PDTags

It works!

Most wouldn’t bother with the integer tags and expression tags – they just make the window only usable by one client at a time. The common approach would be to leave the strings unbound, supplying them as parameters to the window. In any case, you can convert integers to strings with a binding expression instead of an expression tag.

Bumping for the Perspective crowd, this works beautifully in perspective.