# Recipe Load Fail from Transaction Group

**URL:** <https://forum.inductiveautomation.com/t/recipe-load-fail-from-transaction-group/5087>\
**Category:** Ignition\
**Created:** [August 31, 2012, 4:19pm UTC](https://forum.inductiveautomation.com/t/recipe-load-fail-from-transaction-group/5087 "2012-08-31T16:19:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [August 31, 2012, 4:19pm UTC](https://forum.inductiveautomation.com/t/recipe-load-fail-from-transaction-group/5087/1 "2012-08-31T16:19:02Z")

</div>

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:

```auto
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)?

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [August 31, 2012, 5:00pm UTC](https://forum.inductiveautomation.com/t/recipe-load-fail-from-transaction-group/5087/2 "2012-08-31T17:00:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [August 31, 2012, 6:02pm UTC](https://forum.inductiveautomation.com/t/recipe-load-fail-from-transaction-group/5087/3 "2012-08-31T18:02:28Z")

</div>

Beautiful, that worked perfectly. Thanks Travis!
