Adding Items to a TestStand Report Header at Run-Time

Updated Apr 19, 2023

Environment

Software

  • TestStand

I need to add items to the my Report Header at Run-Time. I found information about how to to modify a TestStand XML report header using the stylesheets, but I can't find how to do this on run-time.

You can use the the AdditionalData container to programmatically add custom UUT data to the header, following the next steps:

1.Override the PreUUT Callback in the client sequence file.  Note that the new callback sequence contains the Parameters.UUT property.

2. Add a statement step to dynamically add a property in the Parameters.UUT.AdditionalData container. For example, this expression creates two string data subproperties:

Parameters.UUT.AdditionalData.SetValString("Manufacturer.Name",1,"National Instruments"),

Parameters.UUT.AdditionalData.SetValString("Manufacturer.Location",1,"Debrecen, Hungary"),

Note: Using the SetValString method with 1 as the PropertyOption creates a property if it does not exist. If you want to create a numeric property, use SetValNumber instead.

3. Add a statement step to set the IncludeInReport flag for the AdditionalData property to include all subproperties in the Report.

Parameters.UUT.AdditionalData.SetFlags("",0,PropFlags_IncludeInReport)

The report below includes the custom data in the AdditionalData container.  The process for adding custom Station data is similar, but uses the Parameters.ModelData.StationInfo property instead of Parameters.UUT.

Note: Alternatively, you can manually add data to and enable the IncludeInReport flag for the Locals.UUT or Locals.ModelData.StationInfo container of a process model entry point at edit-time to add UUT or Station data for all client sequence files.

For more information about customizing TestStand reports, refer to Best Practices for NI TestStand Report Generation and Customization and Generating and Customizing Reports in the NI TestStand Help.

Additional Information

Data about the UUT and Station can be accessed in the Parameters.UUT and Parameters.ModelData.StationInfo variables present in many model callbacks. In TestStand 2013 and later, the UUT and StationInfo properties contain an AdditionalData subproperty, which is an unstructured container.  You can add data to this property at run-time without making any changes to the UUT and StationInfo data types.

If you are interested in modifying the report header after the execution of the PreUUT sequence callback, override the ModifyReportHeader callback in the client sequence file following steps 2 and 3 in the Solution section of this document.