I'm having a difficult time getting the integer value of my radio button selection to a UDT.
I have a standard setup with 3 radio buttons. I created a custom property and set it as an integer. Then I binded that custom property to an expression as such-
If({Door Faceplate.Group.Radio Button 1.selected}, 1,
If({Door Faceplate.Group.Radio Button 2.selected}, 2,
If({Door Faceplate.Group.Radio Button 3.selected}, 3,
0)))
I see the custom property value update. However, how do I link/bind this to another tag(ie UDT)?
You need to bind the custom prop to the UDT tag, (bidirectional).
Then add an "On Change" event to your radio button .select property that does what you show above, but writing that value to the custom property.
Assuming you want the tag to also set the Radio Button initially...
Thanks for the response! That solved that portion of my problem.
Now I also do want the tag to set the Radio Button. I notice if I reboot the Vision app, I can see the value saved from memory (it will eventually be set to a PLC), however, the Radio Buttons are all cleared.
Nevermind, I was able to figure out my second question, regarding the tag setting my Radio Button. For each button itself, I set an expression bind to the Data/Selected property, to evaluate if the custom property equals a certain value.
Thanks again!
The only fun thing you may end up having to deal with is the round-robin effect when you start actually using a PLC tag. There's a slight race condition between reads and writes, so when you change the selection, you may see it change, then quickly change back (due to a fresh read) and then change back to what you selected (after the write takes place, and the value is then re-read from the plc)
Now with the binding and scripting added, I notice that when I do select a radio button, I momentarily will see dashed lines surrounding the item. If the radio buttons are grouped together, I will see the highlighting around the group. If the radio buttons are not grouped, I see the highlighting only on the radio button I select. For the radio buttons that do not have binding/scripting on it yet, I do not see the dashed lines. Any idea why this is the case?
If you don't want to see the dashed lines, simply select the Overlay Opt-Out option at the bottom of the binding editor:

Be aware that if you opt out of the overlay to get rid of the styling for writes, you are also getting rid of the error overlays for actual problems with the tag quality. I strongly encourage users to not opt out of overlays unless substitute styling will be used.