Example Code

Iterate Through Every Step in a Sequence File

Code and Documents

Attachment

Download All

Overview

This code can be used as a tool to programmatically modify a certain property for every step in a sequence file. In this case, we are setting the Result Recording Option to "Enabled (override sequence setting)."

Description

In this example, we first prompt the user to choose the sequence file for which they wouldl like to set all steps' Result Recording Option fields to "Enabled (override sequence setting)."

Then, we iterate through every sequence and step group in the sequence file to ensure that the property is modified for every step.

Last, we let the user decide whether the save the changes made.  If the sequence file is loaded into memory while this tool is run, the changes made will be visible immediately.  If the sequence file is closed, you must save the changes in order for them to be visible when opening the file.

This example can be added as a tool in the Sequence Editor Tools menu by navigating to Tools>>Customize>>Add... and adding EnableReporting.seq as an item of the type Sequence File.

Steps to Implement or Execute Code

  1. Open TestSequence.seq and examine the Result Recording Option setting for each step in the MainSequence, SubSequence, and Callback sequences
    1. Note: The Result Recording Option is located in the Step Settings tab under Properties>>Run Options
  2. Close TestSequence.seq (not required)
  3. Open EnableReporting.seq
  4. Navigate to Execute>>Run MainSequence
  5. When prompted for a sequence file to modify, choose TestSequence.seq
  6. Save changes when prompted
  7. Open TestSequence.seq to examine the changes

Requirements

Software

TestStand 2012 or newer

Additional Images or Video


Capture.JPG


Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors