NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

get if local variable exist with teststand API

Hi,
 attach you'll find a sequence file and a VI. This VI should open the Expression Browser and after selection a variable (in this case I select Locals.test) the property object exists should tell me if this local variable exists. This is part of a bigger VI in which help of TS 3.1 API functions I'd like to ensure that the programmer selects a local variable of the type we need (in our case it has to be an array of containers). Some idea to make this work?
 
thanks
 
Alex
Download All
0 Kudos
Message 1 of 2
(4,762 Views)

Alejandro,

I am not sure what you are trying to accomplish.
Why do you want the user to select a specific property?
Could you describe your use case better?
Be aware that the expression browser returns an expression. The user could enter whatever expression he wants.
For your specific example if you select the "test" local variable, the lookup string would be "Locals.test".
Since you are checking if the property exists under Locals, it would return false all the time. If you want to check if the property exists under Locals your lookup string should be "test".
If you want to use "Locals.test" as the lookup string you will have to call 'Exists' on the sequence context.

SequenceContext.AsPropertyObject().Exists("Locals.test")

In order to verify the type of a property object you can use

PropertyObject.GetType() method.

Hope it helps

Antonio Lie.

0 Kudos
Message 2 of 2
(4,735 Views)