Recipe Load Fail from Transaction Group

Hey guys,

I’m starting to fool around with doing some recipe loading from a database via Ignition transaction groups. I got everything working except for a failure indication.

I’m selecting a recipe number from a OPC tag and then running a custom where clause on the database:

Recipe_ndx = {[~]Recipe Number}

when the Recipe_ndx number exists it loads the recipe and pushed it down to the PLC fine, I also have a handshake on success bit set and that works good too.

The problem is when the Recipe_ndx number does not exist, i.e. someone puts in a recipe number that is not in the database. I would like to indicate on the PLC that the recipe did not exist and was not loaded and I thought I could do it with the handshake on fail option but that doesn’t work. Even when there is no recipe loaded the handshake on success bit still comes on. Is there a way to set a PLC bit if the SQL query is invalid (no Recipe_ndx number match)?

Yes, you have to create an expression item that runs a SQL query:SELECT COUNT(*) FROM recipes WHERE id = {path/to/id}You can write the result of the query to a tag. That way when it is 0 you will know about it.

Beautiful, that worked perfectly. Thanks Travis!