Example Code

Passing Parameters to a TestStand Subsequence Called in a New Execution

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • Teststand

Code and Documents

Attachment

Overview

When calling a sub-sequence in TestStand, you can specify that the sequence is called in a new execution.  By default, the new execution is called using a process model entry point, such as single pass.  Because of this, the parameter list for the sequence call step shows the parameters for the entry point sequence in the process model, rather than the parameters of the sequence you are calling.

 

If you need to pass data to the subsequence, there are two approaches you can take:

 

  1. Call the Subsequence without a model, so parameters can be passed directly like other sequence call steps
  2. Call the Subsequence with an entry point, and configure the sequence call step to use the subsequence prototype, instead of the prototype for the single pass entry point.

 

Description

 

This Example demonstrates two approaches for passing parameters to a subsequence called in a new execution

 

Calling the sequence without a process model entry point

In this approach, the sequence is called directly, much in the same way as calling a sequence in a new thread.  A new execution is still created (which will show as a new tab in the sequence editor), but it will not have an associated process model entry point. 

 

To configure a sequence call to use no process model, open the advanced settings for the sequence call and select "Do not use a process model" for the Process model option.  After making this change, the sequence parameters will be shown in the parameter pane and can be configured in the typical way.

 

Calling the sequence with a process model entry point

In this approach, the sequence is not called directly.  Instead, the sequence call step invokes the selected entry point, for example, "Single Pass", within the active process model.  The Entry Points in the models that ship with TestStand include a parameter for the sequence name, which you use to pass the sequence which should be called as the client in the new execution.  

 

Because the subsequence is no longer being called directly, you cannot access the parameters of the sequence.  However, you can pass arbitrary parameters to the process model entry point by specifying a sequence prototype:

  1. On the Module tab of the sequence call step, select the Use Prototype of Sequence" option
  2. Click the configure prototype button, and choose the sequence you are calling

Note: to use this approach, you must add a "sequenceName" parameter to the subsequence so that the sequence name can still be passed to the single pass entry point.

 

Hardware and Software Requirements

TestStand 2014 or compatible 

 

Steps to Implement or Execute Code

  1. Open the example file in the sequence editor
  2. Run the sequence using Execute » Single pass 
  3. Observe that two pop-ups appear explaining each approach

 

Additional Information or References

Al B.
Staff Software Engineer - TestStand
CTA/CLD

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

Contributors