NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

expression syntax..

what is the syntax for the following pre-expression
condition: (free writing)
if (locals.aaa=="") then (locals.aaa=stationglobals.aaa
locals.bbb=stationglobals.bbb
locals.ccc=stationglobals.ccc)

meaning: if some string is empty update it , and others
with data from StationGlobals..

thanks in advance
p.s where can i see more examples for expressions syntax?
0 Kudos
Message 1 of 2
(3,119 Views)
Normally you use the "?:" conditional syntax as follows:

Locals.Number = (Locals.Boolean)? 10 : 5

Also, if you want multiple assignments you can separate them with a comma such as

Locals.Number1 = 1,
Locals.Number2 = 2,
Locals.Number3 = 3

So you could combine these two as follows:

(Locals.Boolean)
?
(
Locals.String = "True",
Locals.Number = 9
)
: Nothing

What is really happening is:
if the boolean is true, the last assigment object is returned "Locals.Number".
if the boolean is false, the conditional returns the null object reference.

Since you are not using the returned value from the conditional, it is just dropped and ignored

Scott Richardson (NI)
Scott Richardson
https://testeract.com
Message 2 of 2
(3,119 Views)