Hello,
I would like to have do this kind of expression:
if (Globals.Tags.Tag1.Value == 0 && Globals.Tags.Tag2.Value == 0){value = 1;}else{value = 0;}
How can I doing it because it seems not working like that. (I would like maybe use it with more tags in the condition) I would like the value of the tag change without delay obviously.
I tried to use it also in the script file of a tag:
if (Globals.Tags.Tag1.Value == 0 && Globals.Tags.Tag2.Value == 0){return = 1;}else{return = 0;}
Could you indicate what it the best way to do it ?
Thank you,
Expression with "if"
Re: Expression with "if"
I had same problem yeasterday!
Solved it like this:
If(condition1)
If(condition2)
{value = 1}
else
{value = 0}
-komppi
Solved it like this:
If(condition1)
If(condition2)
{value = 1}
else
{value = 0}
-komppi
Re: Expression with "if"
I saw in a topic this kind of operation :
But it's not working. Somebody has an idea ?
Thank you
Code: Select all
void Tag1_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
{
if(Globals.Tags.Tag1.Value == 1)
Globals.Tags.Tag2.Value = 1;
else
Globals.Tags.Tag2.Value = 0;
}
Thank you
-
- Posts: 824
- Joined: Tue Mar 13, 2012 9:53 am
Re: Expression with "if"
An expression and script code is not the same thing. In expressions you need to set the "value" variable to the result you want iX Dev to use.
This code only works when you are create a script. It will not work in an expression.
This code only works when you are create a script. It will not work in an expression.
Code: Select all
void Tag1_ValueChange(System.Object sender,...
Best Regards,
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Re: Expression with "if"
Yes, but I don't what is the best way to do it. expression or script ? And how doing it exactly ?
Thank you for your help,
Thank you for your help,
Re: Expression with "if"
I resolved my problem.
If it could help somebody else, I write my code below in Tags' script:
If it could help somebody else, I write my code below in Tags' script:
Code: Select all
public partial class Tags
{
void Tag1_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
{
if(Globals.Tags.Tag1.Value == 1)
{
Globals.Tags.Tag2.Value = 1;
}
else
{
Globals.Tags.Tag2.Value = 0;
}
}
}