How do I Access the Properties and Variables of a Higher Level Sequence?
Primary Software: TestStand
Primary Software Version: 4.1
Primary Software Fixed Version: N/A
Secondary Software: N/A
Problem: I have a main sequence with set properties and variables, but they are not recognized by a subsequence I am calling. How can I access local variables or step properties of a top level sequence (a caller sequence) from a subsequence (a called sequence)?
Solution: There are two methods of accessing these variables and properties in a subsequence:
- (Recommended) Create parameters in your subsequence, then pass by reference the local variable or property that you want to access. You can accomplish this by following these steps:
- Create the parameter in your subsequence
- Right-click the parameter, and verify that the Pass by Reference option is checked.
- In the main sequence, click the Sequence Call step and select the Modules tab
- A red exclamation mark icon should appear, indicating that the new parameter is not addressed in the module. Clicking the icon will generate an entry for the new parameter.
- In the Value cell of the new parameter entry, insert the variable or property to be passed.
- When the subsequence is called by the main sequence, the parameter value will now reflect the value of the specified property or local.
- Access the local variable or step properties directly by using a statement step. In this case, you should use the property path RunState.Caller.Locals.[targetlocal] (for local variables in the step that called the subsequence) or RunState.Caller.Step.[targetproperty] (for properties of the step that called the subsequence).
Related Links: KnowledgeBase 2LGAJ26E: Getting the Name of Any TestStand Property Programmatically in
TestStand
Developer Zone Example: Storing Step Names of a Sequence in a Local Variable
Attachments:
Report Date: 08/29/2001
Last Updated: 01/05/2009
Document ID: 2CSE1DVW