Page 1 of 1

Rules: Multiple IF statements?

Posted: 01 Jun 2018, 13:52
by waspie
I can't find anything that states whether you can have multiple IF statements or not. I'm not trying to nest them, just having more than one in a rule.
With a Nextion, a button press = a number. If you have lots of buttons it would be nice to have one rule to intercept the press and then spin off all the events based on whatever number it is.

Code: Select all

on Nextion#button do
if Nextion#button=1 
event,blahblah
endif
if Nextion#button=2
event,blah
endif
if Nextion#button=3
event,blah3
endif
if Nextion#button=4
event,blah4
endif
endon

Re: Rules: Multiple IF statements?

Posted: 01 Jun 2018, 16:33
by grovkillen
Yes you can use this but it might not be as responsive as you like. The loop will have to run multiple runs to go through the list.

Re: Rules: Multiple IF statements?

Posted: 01 Jun 2018, 17:17
by waspie
grovkillen wrote: 01 Jun 2018, 16:33 Yes you can use this but it might not be as responsive as you like. The loop will have to run multiple runs to go through the list.
yeah that's fine, i'm just trying different things to see what's going to work best for me. thanks for letting me know.

I'm new to using the nextion and want to make this work as well as I can.

Re: Rules: Multiple IF statements?

Posted: 03 Jun 2018, 12:03
by danmero
You can try

Code: Select all

on Nextion#button do 
	event,blah[Nextion#button]
endon

On blah1 do
   # do something
endon

Use button value to create the event name

Regards,