Hi,
I would like to know how you would go about scripting for the following scenarios:
1. setting tag3 to '1' if tag1 = 0 and tag2 = 0
2. setting tag3 to '1' if tag1 = 0 or tag2 = 0
I attempted scenario #2 by using ValueChange for tag1 and tag2 separately but it did not work.
Thanks
Multiple conditions using IF statement
Re: Multiple conditions using IF statement
You could do something like this (example is for both senarios)...
All three tags has been assigned as bool.
Code: Select all
void Tag1_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
{
Update_Tag3();
}
void Tag2_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
{
Update_Tag3();
}
void Update_Tag3()
{
if(Tag1.Value && Tag2.Value)
Tag3.Value = false;
else
Tag3.Value = true;
}
Re: Multiple conditions using IF statement
Thanks Edmund for your help.