Support Forums
Conditional string messages - How?

Hi All,

New to VTScada and evaluating the light version for our manufacturing plant.

I want to display different text (strings) based upon a tag value from our siemens plc, I am getting different values through but can't work out to conditionally call different texts based upon this value.

So for example if tag Part number == 1, display SK90
if Part number == 2, display SK110.

I can use one Ifelse statement to display one string but any more than one if statement and I get invalid expression.

Is there no way of having a text look up table? Seems very complex to just display different strings.

Thanks in Advance
Scott

Hi All, New to VTScada and evaluating the light version for our manufacturing plant. I want to display different text (strings) based upon a tag value from our siemens plc, I am getting different values through but can't work out to conditionally call different texts based upon this value. So for example if tag Part number == 1, display SK90 if Part number == 2, display SK110. I can use one Ifelse statement to display one string but any more than one if statement and I get invalid expression. Is there no way of having a text look up table? Seems very complex to just display different strings. Thanks in Advance Scott

You can update your text to be an expression rather than a string. In that expression, you will often use ternary operators to build your statement. You will likely need to read a bit of the help files for assistance on this, but below is a quick syntax to get you started.

PickValid([PathToPLC/PartNumberTag],0) == 1 
? Concat([PathToSK90/SK90]," ",GetPhrase([PathToSK90/SK90]\Units))
: Concat([PathToSK90/SK90]," ",GetPhrase([PathToSK11/SK11]\Units))

I'd suggest starting with something simple and working up to something as shown above. Also, please note that a simple ternary expression Is shown, but you can do IfElse statements etc. Also, I included the functions Concat(), GetPhrase() and PickValid() as they are very useful in these statements. You should read the help files for each to get a better idea of how to implement each.

Finally, I haven't tested the code smile so take it as an example to work from and start simple like:

[PathToPLC/PartNumberTag] == 1 ? "It is One" ? "It is Not One"
You can update your text to be an expression rather than a string. In that expression, you will often use ternary operators to build your statement. You will likely need to read a bit of the help files for assistance on this, but below is a quick syntax to get you started. ```` PickValid([PathToPLC/PartNumberTag],0) == 1 ? Concat([PathToSK90/SK90]," ",GetPhrase([PathToSK90/SK90]\Units)) : Concat([PathToSK90/SK90]," ",GetPhrase([PathToSK11/SK11]\Units)) ```` I'd suggest starting with something simple and working up to something as shown above. Also, please note that a simple ternary expression Is shown, but you can do IfElse statements etc. Also, I included the functions Concat(), GetPhrase() and PickValid() as they are very useful in these statements. You should read the help files for each to get a better idea of how to implement each. Finally, I haven't tested the code :) so take it as an example to work from and start simple like: ```` [PathToPLC/PartNumberTag] == 1 ? "It is One" ? "It is Not One" ````

Trihedral Engineering Ltd.

Thanks for the help.
I will try that, still find it overly complex for what is a simple task in a lot of HMI software.

Thanks for the help. I will try that, still find it overly complex for what is a simple task in a lot of HMI software.
118
2
2
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