# Multiple trigger

**URL:** <https://forum.inductiveautomation.com/t/multiple-trigger/2717>\
**Category:** Ignition\
**Created:** [March 3, 2011, 7:48pm UTC](https://forum.inductiveautomation.com/t/multiple-trigger/2717 "2011-03-03T19:48:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wesgoad](https://avatars.discourse-cdn.com/v4/letter/w/da6949/32.png) [@wesgoad](https://forum.inductiveautomation.com/u/wesgoad)\
**Post date:** [March 3, 2011, 7:48pm UTC](https://forum.inductiveautomation.com/t/multiple-trigger/2717/1 "2011-03-03T19:48:08Z")

</div>

I am attempting to set up an expression that will look at the time and set the trigger value when the time is 7:28 AM or PM. At the same time, I need to set the trigger flag on the haschanged for another PLC value. From what I gathered, this was suggested in another post, but i could be confused on the basics of it. I am also confused with the Python syntax and the whole process in general. I have tried a number of variations to the syntax.

I keep getting an evaluation error on both expressions. Here is the time check expression:

```auto
if {[.]Hour}= 7 || {[.]Hour} = 19:
	if ({[.]PLCMinute}= 28):
 		{[.]Trigger)}= 1
else:
 	if (hasChanged {[.]MainMotorRunning_4}):
 		{[.]Trigger)}= 1
	else:
 		{[.]Trigger)} = 0)
```

Can you help?

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [March 3, 2011, 8:04pm UTC](https://forum.inductiveautomation.com/t/multiple-trigger/2717/2 "2011-03-03T20:04:28Z")

</div>

> [@](#):
>
> I am also confused with the Python syntax

Indeed, that's your first problem- there should be no python involved 😃

Ok, so you have a trigger in a group- it's an Expression Item named "Trigger", which uses expression sytanx. The difference between the two systems commonly trips up new users, and I wish we had a video outlining the two, but for now there's [this section](http://inductiveautomation.com/support/usermanuals/ignition/about_scripting.htm) in the user manual.

So then, in expression syntax:

`if( ({[.]Hour}= 7 || {[.]Hour} = 19) && {[.]PLCMinute}=28, 
1,
if( hasChanged({[.]MainMotorRunning_4}), 1, 0)
)
`

You were trying to assign a value to "Trigger". This is not how it works- instead, your tag "Trigger" is set to run as an Expression, with the code above. All expressions always boil down to a value, so what we have above is an "if" expression with a nested expression in the "else" case. Here's the user manual entry for the [if function](http://inductiveautomation.com/support/usermanuals/ignition/gen_logic_if.htm), if it's not clear what's going on in that block.

Hope this helps,

---

<div class="post-metadata">

**Author:** ![wesgoad](https://avatars.discourse-cdn.com/v4/letter/w/da6949/32.png) [@wesgoad](https://forum.inductiveautomation.com/u/wesgoad)\
**Post date:** [March 3, 2011, 9:07pm UTC](https://forum.inductiveautomation.com/t/multiple-trigger/2717/3 "2011-03-03T21:07:22Z")

</div>

That was it! && I tried the book method If( condition, trueReturn, falseReturn) and I couldn’t seem to incorporate the minute value into the condition so strayed off into python land to try to fix it.

Thank you Colby!
