SQL and PMI questions

I think your FactorySQL group setup can probably be simplified. You should be able to take a machine down without creating problems. To address your questions:

  1. Make sure that the group isn’t set to “Insert new record” - that’s how you set up historical data logging. You should set it to “update/select custom record” then in the WHERE field type your condition. Keep in mind that this condition applies with respect to the database. You do not need Kepware/PLC values to make this work. The FactorySQL group “knows” which machine you’re referring to by OPC tag paths. It determines which database row belongs to it with the WHERE clause.

  2. I think that Kepware is behaving properly by reporting NULL values when a machine is taken offline. You will see a different value in the “OPC Quality Code”. Check “store OPC Quality code” in the group property. Then use that value in FactoryPMI to show the user that the machine is down and disable it.

  3. I don’t know how FactorySQL could be adding to the database instead of updating it based on NULL values. Groups strictly either keep INSERTING records or UPDATING the same one, based on that group property. If the value is NULL it will write that in either case.