Listen to Database Table Options

I am researching to find the best way possible to listen to a database table and when there is a record in that table, take action.

Records will be written to this database table from an outside Ignition system or some other application and then I want our main Ignition which has control to do what was written to the database table.

Now I know there is bi-directional transaction groups but then you would have to make a transaction group for each tag that needs to be written to. That’s not scalable when you want to write to 10 to 20 tags for 300 + devices that are not of the same type.

That all said, I was hoping to write the tag path to the database and a value. Then the Main ignition system will write that value to that tag path, then it would delete that record from the database. I would think a script would be best for that.

Should I use a timer script that runs every 5 seconds or so for any new records in that table? Or use the new Gateway Scheduled Scripts that runs every 5 seconds or so? Or something different than those 2?

One way or another, you will be polling. Pick the kind of timer you like.

1 Like

My suggestion is to make sure that you have a column in your database table that notes whether or not the row has been processed by ignition, so you are only taking the rows that still need to be processed.

Also, depending on how complex your logic is and how much data you expect per script, 5 seconds might be too fast. Say you have 1000 records that take 10 seconds to process, and then the script starts again, and grabs some of the same records that the previous job is still working on. Depending on what you are doing this might not be a problem, or it might be. Only you will know. Definitely do some empirical testing on the 5 seconds