I'm working in Ignition perspective v8.1. In my view I have several numeric entry fields whose values are tied to recipe tag members in the PLC using indirect tag binding. I have a button on that same view that, when you click it, it runs a script that does a ReadBlocking of the tags and compares the current values with a set of archived values (to eventurally display what has changed). This all works great except in the case below:
The issue is that if I click in the numeric entry field, type a new value, and then immediately click the button (without hitting enter or intentionally clicking out of the numeric entry field), the numeric entry field is writing the tag value while my script is running, and the script does not recognize the new value in time. Adding a one second timer to the script to wait for the tag value to finish writing will make the script work correctly...but I don't like using timers to fix issues like this.
My question is if there is a way my script can wait for all the tag values to be written before attempting the readblocking so I know I'm getting all of the latest values. Maybe some meta data property of the numeric entry fields? Or if someone suggests a different approach entirely that is welcome too!
Consider slightly adjusting your approach, have a custom property that is indirectly bi-directionally bound to the needed plc tag. Have another custom property that is unidirectionally bound to this first property. Bidirectionally bind the numeric entry to this second property. Repeat this for all the tags you need for that screen.
This allows you to see the existing tag values along side the current entered values for comparison. In addition, your script to commit the values can just copy the second property's value to the first, and the indirect binding will take care of the write to the PLC.
If you have a lot of tags you could group the first properties into an object property, and the second items into a different object property (perhaps sourceValue and userValue). This would also simplify your write script down to view.custom.objectA = view.custom.objectB. If you want to save value copies for a different comparison screen, you can take copies of both objects and hand them off to show the difference comparison.
Not reliably. The time it takes to write is not guaranteed, except for the 60/90 second timeouts that might kick in. Plus the subscription poll time variability on the read side.
Okay interesting. So you're kind of creating a layer between the numeric entry field and the tag writing by creating the custom property, and then the script is looking at the custom properties instead of reading from the PLC again so that we have those value instantaneously essentially? That's how I'm interpreting that right now.