General Discussions
Set tags to variable

IfElse([<ADS SERVER\TCP\SLD\GENELINE>] == 0, "<FFFFFFFF>",
IfElse([<ADS SERVER\TCP\SLD\GENELINE>] <= 5, "<FFFF0000>",
IfElse([<ADS SERVER\TCP\SLD\GENELINE>] <= 15, "<FFFFFF00>",
IfElse([<ADS SERVER\TCP\SLD\GENELINE>] <= 25, "<FF00FF00>",
IfElse([<ADS SERVER\TCP\SLD\GENELINE>] <= 35, "<FF0000FF>",
IfElse([<ADS SERVER\TCP\SLD\GENELINE>] <= 45, "<FFFF00FF>",
IfElse([<ADS SERVER\TCP\SLD\GENELINE>] <= 55, "<FF808080>",
IfElse([<ADS SERVER\TCP\SLD\GENELINE>] <= 65, "<FFFFC0CB>","<FFFFFFFF>" ))))))))

how to change the text expression to something like this below

[<ADS SERVER\TCP\SLD\GENELINE>] == X,
IfElse(X == 0, "<FFFFFFFF>",
IfElse(X <= 5, "<FFFF0000>",
IfElse(X <= 15, "<FFFFFF00>",
IfElse(X <= 25, "<FF00FF00>",
IfElse(X <= 35, "<FF0000FF>",
IfElse(X <= 45, "<FFFF00FF>",
IfElse(X <= 55, "<FF808080>",
IfElse(X <= 65, "<FFFFC0CB>","<FFFFFFFF>" ))))))))

but its still got error in expression
i don't want to rewrite it all because there are so many object i've to change
thank you

IfElse([&lt;ADS SERVER\TCP\SLD\GENELINE&gt;] == 0, &quot;&lt;FFFFFFFF&gt;&quot;, IfElse([&lt;ADS SERVER\TCP\SLD\GENELINE&gt;] &lt;= 5, &quot;&lt;FFFF0000&gt;&quot;, IfElse([&lt;ADS SERVER\TCP\SLD\GENELINE&gt;] &lt;= 15, &quot;&lt;FFFFFF00&gt;&quot;, IfElse([&lt;ADS SERVER\TCP\SLD\GENELINE&gt;] &lt;= 25, &quot;&lt;FF00FF00&gt;&quot;, IfElse([&lt;ADS SERVER\TCP\SLD\GENELINE&gt;] &lt;= 35, &quot;&lt;FF0000FF&gt;&quot;, IfElse([&lt;ADS SERVER\TCP\SLD\GENELINE&gt;] &lt;= 45, &quot;&lt;FFFF00FF&gt;&quot;, IfElse([&lt;ADS SERVER\TCP\SLD\GENELINE&gt;] &lt;= 55, &quot;&lt;FF808080&gt;&quot;, IfElse([&lt;ADS SERVER\TCP\SLD\GENELINE&gt;] &lt;= 65, &quot;&lt;FFFFC0CB&gt;&quot;,&quot;&lt;FFFFFFFF&gt;&quot; )))))))) how to change the text expression to something like this below [&lt;ADS SERVER\TCP\SLD\GENELINE&gt;] == X, IfElse(X == 0, &quot;&lt;FFFFFFFF&gt;&quot;, IfElse(X &lt;= 5, &quot;&lt;FFFF0000&gt;&quot;, IfElse(X &lt;= 15, &quot;&lt;FFFFFF00&gt;&quot;, IfElse(X &lt;= 25, &quot;&lt;FF00FF00&gt;&quot;, IfElse(X &lt;= 35, &quot;&lt;FF0000FF&gt;&quot;, IfElse(X &lt;= 45, &quot;&lt;FFFF00FF&gt;&quot;, IfElse(X &lt;= 55, &quot;&lt;FF808080&gt;&quot;, IfElse(X &lt;= 65, &quot;&lt;FFFFC0CB&gt;&quot;,&quot;&lt;FFFFFFFF&gt;&quot; )))))))) but its still got error in expression i don&#039;t want to rewrite it all because there are so many object i&#039;ve to change thank you

Copy the expression into a word processor and use a "find and replace" tool.

Note that the "==" does not assigne the value of the tag to X, it is comparing the two operands.

Where is this being used, referencing the below help page, "The assignment operator, =, and any variation thereof such as add equals, cannot be used in a tag expression."

https://www.vtscada.com/help/Content/Scripting/Functions/Operators.htm?tocpath=Scripting%7COperators%20and%20Functions%7C_____1

Copy the expression into a word processor and use a &quot;find and replace&quot; tool. Note that the &quot;==&quot; does not assigne the value of the tag to X, it is comparing the two operands. Where is this being used, referencing the below help page, &quot;The assignment operator, =, and any variation thereof such as add equals, cannot be used in a tag expression.&quot; https://www.vtscada.com/help/Content/Scripting/Functions/Operators.htm?tocpath=Scripting%7COperators%20and%20Functions%7C_____1

Might be easier to show as a ternary since the conditions are simple. Also be sure that the tag is expecting a string as the output (IE: An I/O and calc tag in calculation mode with the type as a string).

[<ADS SERVER\TCP\SLD\GENELINE>] == 0 ? "<FFFFFFFF>":
[<ADS SERVER\TCP\SLD\GENELINE>] <= 5 ? "<FFFF0000>",
[<ADS SERVER\TCP\SLD\GENELINE>] <= 15 ? "<FFFFFF00>",
[<ADS SERVER\TCP\SLD\GENELINE>] <= 25 ? "<FF00FF00>",
[<ADS SERVER\TCP\SLD\GENELINE>] <= 35 ? "<FF0000FF>",
[<ADS SERVER\TCP\SLD\GENELINE>] <= 45 ? "<FFFF00FF>",
[<ADS SERVER\TCP\SLD\GENELINE>] <= 55 ? "<FF808080>",
[<ADS SERVER\TCP\SLD\GENELINE>] <= 65 ? "<FFFFC0CB>":
"<FFFFFFFF>"

It the expression above fails, start with a simple expression [<Target Tag>] == 0 ? 1 : 0 and then expand your expression from there so you can figure out where the issue is occuring.

Might be easier to show as a ternary since the conditions are simple. Also be sure that the tag is expecting a string as the output (IE: An I/O and calc tag in calculation mode with the type as a string). ```` [&lt;ADS SERVER\TCP\SLD\GENELINE&gt;] == 0 ? &quot;&lt;FFFFFFFF&gt;&quot;: [&lt;ADS SERVER\TCP\SLD\GENELINE&gt;] &lt;= 5 ? &quot;&lt;FFFF0000&gt;&quot;, [&lt;ADS SERVER\TCP\SLD\GENELINE&gt;] &lt;= 15 ? &quot;&lt;FFFFFF00&gt;&quot;, [&lt;ADS SERVER\TCP\SLD\GENELINE&gt;] &lt;= 25 ? &quot;&lt;FF00FF00&gt;&quot;, [&lt;ADS SERVER\TCP\SLD\GENELINE&gt;] &lt;= 35 ? &quot;&lt;FF0000FF&gt;&quot;, [&lt;ADS SERVER\TCP\SLD\GENELINE&gt;] &lt;= 45 ? &quot;&lt;FFFF00FF&gt;&quot;, [&lt;ADS SERVER\TCP\SLD\GENELINE&gt;] &lt;= 55 ? &quot;&lt;FF808080&gt;&quot;, [&lt;ADS SERVER\TCP\SLD\GENELINE&gt;] &lt;= 65 ? &quot;&lt;FFFFC0CB&gt;&quot;: &quot;&lt;FFFFFFFF&gt;&quot; ```` It the expression above fails, start with a simple expression [&lt;Target Tag&gt;] == 0 ? 1 : 0 and then expand your expression from there so you can figure out where the issue is occuring.

Trihedral Engineering Ltd.

43
2
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