Example Code

Using TestStand Temporary Globals (Engine.TemporaryGlobals)

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

TestStand provides Temporary global variables which exist for the lifetime of the TestStand engine.  This example demonstrates how to create and use Temporary Global variables in TestStand.

 

Description

 Temporary Globals are variables which are located in the Engine.TemporaryGlobals object.

 

  • Like station global variables, these variables persist between multiple executions.
  • Unlike station globals, temporary globals do not persist on disk and are removed upon engine shutdown.

You must create these variables at runtime using the TestStand API. For information on using the TestStand
API to create properties, refer to <TestStand Public>/Examples/TestStand API/Creating New Properties Using API

 

Use temporary globals to store configuration data that pertains to the current instance of TestStand, but should not
persist for new TestStand instances. This example uses a Temporary global variable to track the number of
times this sequence has executed in the current instance of TestStand.

 

Hardware and Software Requirements

Using Temporary Globals - TS2017.seq

TestStand 2017 or Compatible

 

Using Temporary Globals - TS2012.seq

TestStand 2012 SP1 or Compatible

 

Steps to Implement or Execute Code

  1. Run the MainSequence sequence using Execute » Run MainSequence.
  2. Observe that the initialization dialog appears on the first run. This dialog will not appear on subsequent runs.
  3. Observe the execution count is '1'. Run the example again and note that it increments each execution.
  4. Close TestStand and re-open it, then run the example again. Observe that the execution count has reset, and the initialization dialog again appears.
 
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.

Comments
Member
Member
on

Nice stuff, it solves a lot of problems with normal Station Globals 😃

Is there any chance to put this on Variables Pane?

I realize that it may be meant to be hidden, but it makes debugging for less advanced Users really painful.

Contributors