NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get an array of property names from a thisContext reference in LV

Navigating through the large mass of methods for TS objects is rather difficult.  I'm looking for the series of methods to read and set all of the properties for a given sequence, and possibly its subsequences, in LabVIEW when I dont know the name of the properties.  My current approach is
 
Pass thisContext to LabVIEW >>> get array of property names for this step >> get or set these properties with "set property value.vi" and "get property value.vi">> thisContext.nextStep >>> repeat
 
My difficulties are that I dont know how to get access to the property names and also that I am easily getting lost on what context I actually have for a given reference  I plan to use this information to create a custom spreadsheet to edit and then have an option to load it back in, as the layout of import/export properties is unacceptable.  The only difference will be if I get or set the properties after I have their names.  Any help would be appreciated.
Message 1 of 5
(3,493 Views)
Howdy Dillon,

TestStand does have quite a handful of API methods and properties that really just take some experience and practice to get used to. The BEST guide that I can give you that I constantly use is the "Using TestStand API Objects" section in the TestStand Help (Help >> TestStand Help; Select the Index tab and type 'using teststand api objects'). This interactive guide allows you to determine what path to take and what properties and methods you need to access certain objects.

If you take a look at this guide, you will notice the Engine object and the SequenceContext objects are the outer most objects.  This is because generally when you are programming, you will always have access to one of these objects and thus use these objects to obtain and access other objects.  So if you passed in the SequenceContext to LabVIEW and dropped a property node down (see attached screenshot "SequenceContext.jpg") and tried to select a property, you would see "ApplicationIsEditor, Caller, CallDiscardResults, ....". If you click on the SequenceContext object in the interactive help guide, it will take you to the page for the SequenceContext's properties and methods and you will notice they are the same as in LabVIEW. 

So for example, suppose you wanted to get the name of the sequence that was associated with that sequence context. Then you would use the Sequence Context to get a Sequence Object and then use the properties for a Sequence object to get the name. See the attached screenshot "Sequence Name.jpg".

Hope this helps.

Best Regards,
Jonathan N.
National Instruments
Download All
Message 2 of 5
(3,475 Views)
Thank you for the response.  I guess I made my knowledge sound a bit lower then it actually is.  Smiley Happy However, your response encouraged me to keep digging through TS API reference.  I came up with a solution that parses through all the properties for the steps in a sequence.  There was a minor change from my original idea in that it now reads the file directly, but the idea would be the same for both approaches.
0 Kudos
Message 3 of 5
(3,430 Views)

Howdy Dillon,

It appears you are on the right track but I do have one suggestion after browsing through you VI. It’s not the best practice to use Application Manager Control simply in your code modules. The Application Manager Control was designed to be used in Operator Interfaces. To access the Engine, you could either instantiate the Engine directly in LabVIEW, or pass in the SequenceContext into a LabVIEW VI and access the Engine that way. See the attached screenshots.

There is also a good KnowledgeBase entitled Getting a List of TestStand Variable Names (i.e. Locals, Parameters, FileGlobals, StationGlobals) Pr... that is very helpful.

Good luck.

Best Regards,

Jonathan N.
National Instruments
Download All
Message 4 of 5
(3,423 Views)
Thank you for your suggestion.  I changed my program to calling the engine directly and its running well.
0 Kudos
Message 5 of 5
(3,398 Views)