NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get values of variable at runtime

How to get values of variables at runtime dyanmically in loop?
Please see the attached file for better reference.
0 Kudos
Message 1 of 2
(2,891 Views)
Hello Vishal,

I guess your question is more like how to specify variables programatically. In other words, if you have Locals.MyVar1 and Locals.MyVar2, how to access this two variables programatically using other variables. Example: Instead of using Locals.MyVar1, use something like Locals.MyVarX, where X is a numeric variable.

If this is your question, TestStand has a function called Evaluate that basically "Evaluates" a string.

Example: You can't directly use Locals.MyVarX, but you can have something like:

Evaluate("Locals.MyVar" + Str(Locals.X))

In the above example, the Evalute function will return the contents of Locals.MyVar0 (if Locals.X = 0).

I'm also attaching a modified version of your sequence that uses the evaluate function
.

Regards,

Roberto Piacentini
National Instruments
Applications Engineer.
0 Kudos
Message 2 of 2
(2,891 Views)