General Discussions
Tag Expression

Hi All,

I want to write three status from two different tag values.

"1" Means "Open"
"2" Means "Close"
"3" Means "Travel"

How to write the tag expression referencing another two tag value in VT SCADA.

if [Sludge Dewatering\ZIO_6333A]==1 then "1"
else if [Sludge Dewatering\ZIC_6333A]==1 then "2"
ELSE "3"

Hi All, I want to write three status from two different tag values. "1" Means "Open" "2" Means "Close" "3" Means "Travel" How to write the tag expression referencing another two tag value in VT SCADA. if [Sludge Dewatering\ZIO_6333A]==1 then "1" else if [Sludge Dewatering\ZIC_6333A]==1 then "2" ELSE "3"

While you don't have to, you may wish to use the ternary operator for this. Here is how you would format the statement:

variable = condition1 ? value1 : condition2 ? value2 : value3

This means that if condition1 is true, the variable will be assigned value1, else if condition2 is true, the variable will be assigned value2, else the variable will be assigned value3.

For your expression:

  [Sludge Dewatering\ZIO_6333A]==1 ? 1
: [Sludge Dewatering\ZIC_6333A]==1 ? 2
: 3
While you don't have to, you may wish to use the ternary operator for this. Here is how you would format the statement: ```` variable = condition1 ? value1 : condition2 ? value2 : value3 ```` This means that if condition1 is true, the variable will be assigned value1, else if condition2 is true, the variable will be assigned value2, else the variable will be assigned value3. For your expression: ```` [Sludge Dewatering\ZIO_6333A]==1 ? 1 : [Sludge Dewatering\ZIC_6333A]==1 ? 2 : 3 ````

Trihedral Engineering Ltd.

So how we use the same expression in I/O tags? or I should use the expression in any other widget Properties.

So how we use the same expression in I/O tags? or I should use the expression in any other widget Properties.
edited Jan 19 at 7:04 am

You'll want to create an I/O and calc tag. Put it into discrete calculation mode, enter the expression in the calculation location, and then write the value to the desired address.

There is too much there to fully explain in this post but we have lots of free training avaliable at https://home.academy.vtscada.com/

You'll want to create an I/O and calc tag. Put it into discrete calculation mode, enter the expression in the calculation location, and then write the value to the desired address. There is too much there to fully explain in this post but we have lots of free training avaliable at https://home.academy.vtscada.com/

Trihedral Engineering Ltd.

Not sure if i understood correctly, but when I had to do something like this, i ended up nesting couple ifelse loops:

IfElse([<Sludge Dewatering\ZIO_6333A>] == 1, "OPEN", IfElse([<Sludge Dewatering\ZIC_6333A>] == 2, "CLOSE", "TRAVEL" ))

*Edit: if you gotta use numbers instead:

IfElse([<Sludge Dewatering\ZIO_6333A>] == 1, "1", IfElse([<Sludge Dewatering\ZIC_6333A>] == 2, "2", "3" ))

Not sure if i understood correctly, but when I had to do something like this, i ended up nesting couple ifelse loops: IfElse([&lt;Sludge Dewatering\ZIO_6333A&gt;] == 1, &quot;OPEN&quot;, IfElse([&lt;Sludge Dewatering\ZIC_6333A&gt;] == 2, &quot;CLOSE&quot;, &quot;TRAVEL&quot; )) *Edit: if you gotta use numbers instead: IfElse([&lt;Sludge Dewatering\ZIO_6333A&gt;] == 1, &quot;1&quot;, IfElse([&lt;Sludge Dewatering\ZIC_6333A&gt;] == 2, &quot;2&quot;, &quot;3&quot; ))
edited Jan 22 at 1:59 am
130
5
3
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft