Hello folks,
Could someone please help me out?
I made an OPC tag and a Query data set. I would like to update the query data set values every time the OPC tag changes state. I do not know the syntax to trigger query data set to get new value.
This is what i have for the OPC tag, the "then" part i do not know how to write
if previousValue.value != currentValue.value and currentValue.value == 1
Tag event script will help. CurrentValue and previousValue are already there.
Then script what you want.
https://docs.inductiveautomation.com/display/DOC81/Tag+Event+Scripts
What do you mean by "query dataset" ?
If it's a database table, then transaction groups are what you're looking for.
It is a really bad idea to run DB queries in tag events (on the tag). The thread pool for tag events is easily bogged down by events that perform any complex operation (more than a millisecond or two), particularly operations that reach out to a network resource. The entire tag event system will grind to a halt if this happens. Don't do it.
I am already using tag event script.
Yes, it is a database table but I thought transaction group always running and update itself. I only want to trigger the script to fill out my query tag when certain event comes true. And the syntax to fill out my query tag (dataset type, multiple values inside the tag) is where I am stuck.
If using a tag event to trigger is bad... what are other solutions?
Thanks
I recommend using a project's gateway tag change event instead of a tag's valueChange event for anything that might take more than single-digit milliseconds.
In that case, could you please help me out with the syntax? I've done single parameter query via gateway event before but I do not know how to write when the destination is a dataset and not a single value tag.
Thanks
You have to be very detailed and very specific about the functions you want, your database structure, and how you want to modify which data.
In addition, before operating the database, have you made a backup? What are you going to do if the results don't meet your expectations?
May I ask, if the update speed of the PLC value is limited by the PLC program, does the execution time of the variable script matter? For example, a script of 10 seconds and an update rate of 1 minute.
Thank you.
Yes, because all of the tag event scripts are running in the same thread pool.