How Can I Programmatically Create Sequence File Global Variables in TestStand?

Updated Nov 28, 2017

Reported In

Software

  • TestStand

Other

TestStand

Issue Details

I want to programmatically create Sequence File Global variables for use in my sequence. How can I do this?

Solution

You can create Sequence File Global variables using the TestStand API either in your sequence or in a code module. You can use the TestStand API methods of SetValNumeric(), SetValBoolean(), SetValString(), SetValVariant(), and SetValIDispatch()with the 'options' parameter set to the value 1 for "insert if missing". This will add the file global to the current execution, however it will not be part of the original sequence file. If you want to add the file global to the original sequence file, use the following API calls either in your code module or in your sequence using the ActiveX/COM Adapter:
  1. Get a reference to the Sequence File's FileGlobalsDefaultValues
     
    ActiveX/COM reference: Sequence File
    Automation Server: TestStand API (your current version #)
    Object Class: Sequence File
    Action: Get Property
    Property: FileGlobalsDefaultValues
    Return Value: Locals.FileGlobalsReference

  • Using this reference, use one of the SetVal* methods (any of the functions listed above, for example SetValNumeric()) with the options flag set to 1 (insert if missing) to insert a new file global. By creating the file global with the FileGlobalsDefaultValues, the value is stored in the original sequence file. 
     
    ActiveX/COM reference: Locals.FileGlobalsReference 
    Automation Server: TestStand API (your current version #)
    Object Class: Property Object
    Action: Call Method
    Method: SetVal*
    lookupString: "FileGlobals.NewFileGlobal"
    options: 1
    newValue: 123

Additional Information

For more information on the SetVal* methods, see the TestStand Programmer Help. See the Related Links section below for a tutorial on programatically creating variables in TestStand..

WAS THIS ARTICLE HELPFUL?

Not Helpful