NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How can i check if a variable exists?

Solved!
Go to solution

Hello,

is there function that i can use in a if/else statement to check if a variable exists?

Something like

 

if (exists(StationGlobal.MyVariable))

do seomething

else

now do this

end

 

Thanks

0 Kudos
Message 1 of 3
(2,886 Views)

You can use the PropertyExists() function to check for the variable (it returns a boolean).

 

There are a lot of resources on the forums on how to write an if/else expression. Look for "Conditional" operator in the link to get started.

https://zone.ni.com/reference/en-XX/help/370052AA-01/tsfundamentals/infotopics/operators_expression/

Message 2 of 3
(2,873 Views)
Solution
Accepted by topic author OnlyOne

StationGlobals.Exists("MyVariable",0)


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 3
(2,868 Views)