From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems accessing variables through Labview..please help!

Hi all,
I've created a UI in LV 7.1 and calling the Teststand API for execution of certail sequence files. I am unable to get to read the variables from Teststand after execution, even after creating a reference to the locals through Sequence File->Get Sequence->Locals->GetValNumeric references. It doesen't return anything back at all. I am unable to create a Sequence Context with a proper reference attacted for the TS.IEngine ActiveX refnum.
Can someone please help? I've been running around with this for days now. I'd really aprpeciate some help.

Thanks in advance,
Anshul
0 Kudos
Message 1 of 2
(2,773 Views)
Hello Anshul,

There are a couple of different ways to access TestStand local variables within LabVIEW depending on how the VI and TestStand are related. First of all, it is important to understand what a Sequence Context is. The TestStand helps defines it as: "... an object in the TestStand API that represents the execution state of a sequence. For each active sequence, TestStand maintains a sequence context you can use to access all the objects, variables, and properties that relate to the execution of the sequence." So you cannot create a sequence context yourself (in fact, the only API reference that you can create is a reference to the TestStand engine). The Context refers to the state of a particular execution at a particular time. Therefore, to access TestStand variables within a Sequence Context, you must pass that context into LabVIEW.

If the LabVIEW VI is called from a step in TestStand as a code module, you can simply pass "ThisContext" as an input. "ThisContext" is a variable within the context that is a reference to the Sequence Context itself. You could also just pass the variable of interest itself into the VI as an input.

If the LabVIEW VI is the Operator Interface (OI), it is a little more difficult. Although you are able to get access to a sequence file from LabVIEW, the only way to get reference to variables in a currently executing sequence are to have a reference to the Sequence Context (which I have already said, you cannot create). You must somehow pass the context from the executing sequence into LabVIEW. The way to accomplish this is to use UIMessages. There is an API method (an execution method specifically) that you can call that enables you to pass any type of data from an executing sequence into the OI. It gets handled by the OI's event handler. For information on UIMessages and for example code, go to www.ni.com/support and search using the keyword, "uimessage".

I hope that this helps. Take care and have a great day!

Sincerely,

Aaron B.
National Instruments
0 Kudos
Message 2 of 2
(2,754 Views)