Read, Write Tag Values, part 2

Hello all,

This is the view:
image

This is the view params:
image

Each tag (34 total) was made with a UDT, and has three parameters that I need to utilize.
Percentage - which are the decimal values displayed, and further displayed in the pink box (decimal values)
Volts - which is only displayed in the yellow box (decimal values)
Enabled - which is indicated by the color of the Percent labels (values: 0 or 1)

The label shown with "CZ01" displayed, is linked to view parameter zoneKey, which is part of a tag name, so we know which area we are adjusting. Con and Bay are used to tell us which side of the machine we are adjusting.

The labels on the left side of the view, with decimals, are bound to tags. The center column is for an area description. When the decimal label is clicked, the view parameter is updated to the area description, i.e. CZ01. This is also a part of each tag's name, which allows me to use indirect binding to the pink and yellow components. The "Enable/Disable" button text is also bound to a view parameter, to indicate if the tag is enabled or disabled. So far so good.

I don't know if I am making this harder than it should be or am I following the right path?

Also, I noticed that the binding on the yellow box, won't allow for bi-directional.

I want to:

  • use the plus/minus button to increment the values in the yellow box
  • when the values change, write that value to the current tag
  • use the Enable button to change the enable value in the current tag

I appreciate your time and feedback!
Mike

Anyone?

1 Like

Well, I noticed that if I add a format transform to the binding, the Bi-directional option is disabled. Why is that?

Any kind of transform potentially loses data that might be required for the reverse operation. And there's no way for Ignition to read your mind as to what that reverse transform should be.

You can create a custom property on the components that have a transform. Name it something like raw_value. Add your indirect binding to it which will allow bi-direction, then bind your actual value or text prop to the raw_value with the transform added there. Then anytime you want to write to the tag, write to the raw value prop instead of the value/text prop.

image

Gotcha. From a logical standpoint, a format transform should only affect the display formatting, as suggested in the popup dialog box when one goes to apply a transform.

However, applying a numeric format, found in the props category, works well.

Sounds interesting. I'll give it a shot. However, removing the transform and using a numeric formatting pattern in the props works well too.

So here's my solution:
The two view params used for enabling/disabling a tag are indirectly bound to a tag using the view param zoneKey and are shown as "bidirectional" in the params box, but not in the binding. (Does anyone have any insight into the difference here:
image
This versus bidirectional tag binding...

The plus/minus script action is simple, check for the enabled bit, 1, get the current value and add a predetermined incremental value. If the resulting value is above a certain set point, use the set point value.

The Enable buttons simply change view params enable bit.

One issue I had was that the labels with decimal values on the left, when clicked/tapped, they would also write to the view params enable bit, creating a bit of confusion and a circular like read/write.

So far, it all seems to work as intended.

Thank you @pturmel, @dkhayes117