# Multiple task triggered by a TG

**URL:** <https://forum.inductiveautomation.com/t/multiple-task-triggered-by-a-tg/9050>\
**Category:** Ignition\
**Created:** [September 11, 2014, 9:52pm UTC](https://forum.inductiveautomation.com/t/multiple-task-triggered-by-a-tg/9050 "2014-09-11T21:52:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manuel](https://avatars.discourse-cdn.com/v4/letter/m/67e7ee/32.png) [@Manuel](https://forum.inductiveautomation.com/u/Manuel)\
**Post date:** [September 11, 2014, 9:52pm UTC](https://forum.inductiveautomation.com/t/multiple-task-triggered-by-a-tg/9050/1 "2014-09-11T21:52:19Z")

</div>

Hi,

I need your advice to solve a problem.  
This is the thing, I have to run a comparison in a TG between a value coming from a PLC and a value coming from a DB. If those values are not equals There are few tasks I have to run in certain order. Mainly all the tasks are updates/adds in the DB. The number of tasks could change depending of the result of the previous task.  
I tried to solve this problem using expression but It’s complicate run multiple queries in the same item, I tried nesting ifs but it’s hard to catch errors doing that.  
I would like to know if you faced a similar situation and how did you tackle the problem.

Regards  
Manuel

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [September 11, 2014, 10:16pm UTC](https://forum.inductiveautomation.com/t/multiple-task-triggered-by-a-tg/9050/2 "2014-09-11T22:16:20Z")

</div>

You should write a Python script to implement this.

Learn more here: [inductiveautomation.com/support … ipting.htm](https://inductiveautomation.com/support/usermanuals/ignition/index.html?about_scripting.htm)

Best,

---

<div class="post-metadata">

**Author:** ![Manuel](https://avatars.discourse-cdn.com/v4/letter/m/67e7ee/32.png) [@Manuel](https://forum.inductiveautomation.com/u/Manuel)\
**Post date:** [September 12, 2014, 6:05pm UTC](https://forum.inductiveautomation.com/t/multiple-task-triggered-by-a-tg/9050/3 "2014-09-12T18:05:15Z")

</div>

Thanks nmudge!

That was an option but I wanted to see if there is a way to solve the problem using expression.  
Another option I have been thinking of is to create a store procedure in the DB and call it from the TG.

If anyone has another idea I will appreciate it.

Regards,  
Manuel

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [September 12, 2014, 8:28pm UTC](https://forum.inductiveautomation.com/t/multiple-task-triggered-by-a-tg/9050/4 "2014-09-12T20:28:15Z")

</div>

Yea, you could use a stored procedure. You also might want to see if Transaction Groups can help you here.

---

<div class="post-metadata">

**Author:** ![Manuel](https://avatars.discourse-cdn.com/v4/letter/m/67e7ee/32.png) [@Manuel](https://forum.inductiveautomation.com/u/Manuel)\
**Post date:** [September 19, 2014, 6:59pm UTC](https://forum.inductiveautomation.com/t/multiple-task-triggered-by-a-tg/9050/5 "2014-09-19T18:59:59Z")

</div>

I ended up solving my problem with a DB trigger.

Thanks for your help guys!
