Reading AdditionalResults Programatically Using the TestStand API in LabVIEW

Updated Jun 12, 2023

Environment

Software

  • TestStand
  • LabVIEW

When developing a custom report processor or callback for TestStand using LabVIEW, you might be required to process or parse the properties and information contained in the AdditionalResults container of each test step. This article will explore two different approaches to obtaining this data using the TestStand API in LabVIEW.

Software Required: TestStand, LabVIEW.

Intended Audience: This article is intended for TestStand developers that need to customize a report processor or callback to meet specific data reporting requirements.

Prerequisites:

  • To illustrate both approaches, you will install and use the NI Simple Text Report example for TestStand.
  • To install this example, access C:\Users\Public\Documents\National Instruments\TestStand 2021 (64-bit)\Examples\Customizing Result Processing\Model Plugin - Simple Text Report location, open Install Simple Text Report Plugin.seq sequence file and follow the instructions for LabVIEW.

Setup:

  • Once the Simple Text Report Plugin example is installed, you can find it at C:\Users\Public\Documents\National Instruments\TestStand 2021 (64-bit)\Components\Models\ModelPlugins with the name NI_SimpleTextReport_LabVIEW.
  • You will open the example folder and then open the SimpleTextPlugin.llb LabVIEW library.
  • Once the LLB Manager is open, browse through the elements and open the SimpleTextPlugin.lvlib LabVIEW library as shown in the following image.
 
image.png
 
  • The VIs included in the SimpleTextPlugin.lvlib library perform different processes needed for the Simple Text Report Processor to work. You will select and open the ProcessResultList.vi for this article, as shown in the image below.
 
image.png
 
  • The ProcessResultList.vi processes the result list passed as a parameter and includes it in the report section as a parameter. The Options argument specifies whether the columns are padded, while the Additional Information parameter specifies which sequence file generated this result.
  • This VI will be the starting point to implement both approaches to retrieve the AdditionalResults properties of the steps.
 

First Approach: Granular Access to AdditionalResult Properties.

  • The block diagram of the ProcessResultList.vi shows an iterative process through the property elements of the Result List object to parse them into a simple text report. Not all properties, like the AdditionalResults ones, are processed.
 
image.png
 
  • The following VI snippet provides an example of how to manipulate the Result List In reference to obtaining some properties of the Additional Results property object. Each step of the diagram has been numbered to facilitate its description.
 
VI Snippet
  1. Using the Result List In reference, you can use the GetPropertyObject method, with AdditionalResults as the lookupString parameter to obtain the reference of the Additional Results property object of the step.
  2. The method GetNumElements will provide the number of elements contained in AdditionalResults. It is important to mention that containers and arrays will be counted as one element.
  3. Using a For Loop and the GetPropertyObjectByOffset method, you can iterate through the elements of AdditionalResults and obtain their references.
  4. You can use the reference of the AdditionalResults element to read its properties or use a method. For example, you will read the Type property reference of one of the elements in this step.
  5. Using the Type reference obtained in the previous step, you can use the DisplayString and ValueType methods to get the type of the AdditionalResults element as a string or a number, respectively.
  6. If the element being processed is an array running the GetNumElements method on its reference will return the number of elements in the array. For other cases, it will return 0.
  7. To read the value of an AdditionalResults element, you can use the GetValVariant method with "Value" as the lookupString parameter. This method will return a variant with the value of the property, but only if the element is not an array or container. You can use this result with ValueType to cast the value to a specific datatype.
  8. Finally, you can use the GetDisplayNames method to get the DisplayName Property and Value. The lookupString is left blank to refer to the current object, not its properties.
 
  • It is worth mentioning that arrays and containers will require extra steps to obtain the values and properties of their compounding elements. For example, using the obtained reference of an Array on step (2) to get the number of its elements, and then proceed with the other steps to get the values.
  • For more information about the PropertyObject object, its methods, and properties, consult the NI TestStand Help locally or online.
 

Second Approach: Retrieving XML

  • An alternative approach for those who have experience working with XML is the use of the PropertyObject GetXML method, as shown in the following VI Snippet.
Get XML VI Snippet
  • This method recreates an object using XML, and it is useful to exchange data between TestStand and other applications.
  • For more information about the output of the GetXML method refer to the World Wide Web Consortium-compliant XML schema file, PropertyObject.xsd, located in the <TestStand>\Components\Models\TestStandModels directory.
  • For XML reports XSD schema definition refer to <TestStand>\Components\Models\TestStandModels\Report.xsd file.