Multiple State IF

I try to make a multiple state IF.


If (Tag1) then 1

if (Tag2) then 2

else 0

How I can make It in ignition?

Thank you!

assuming the tags are bools
in Expression



value = 0
if Tag1 == 1:
    value = 1
elif Tag2 ==1:
    value = 2

But what do you want if both are true?

1 Like

If tag 2 and not Tag 1 then 2

Like this I think ?


Pascale, either will be fine (except you have one too many “)” on the right), the expression will evaluate Tag1 first and if true will return 1 even if Tag2 is also true, Tag1 has to be false for the second “if” to be evaluated so no real need for

It’s works well.

Thank you!

This post may be helpful as well…

I’m also a Factory Talk Familiar,

I will be good soon in Ignition To :wink:

Thank you !

Sorry, you will hate FactoryTrash after you see what you have been missing.