Dan,
There are 3 ways you can access the local variables of the calling sequence from the callee:
1) Passing the local variables as parameters (as described by James Grey's answer). This is a simple and easy method. However, the disadvantage would be that you'll have to add to the callee as many parameters as local variables you want to access.
2) From the callee, you can access any property of the calling sequence (including local variables, file globals, parameters, step properties...) through the "RunState.Caller" property. For i.e., if the calling sequence has a local variable called "MyVariable", the propery path you would use from the callee would be "RunState.Caller.Locals.MyVariable". From the RunState.Caller property you have access to the sequence context of the calling sequence! Therefore, you could access any property of the calling sequence by using the correct property path.
This second method will work when the callee is running in the same thread as the calling sequence or even in a new thread. However, it won't work if it is called in a New Execution, in which case, the RunState.Caller property doesn't exist.
3) Add an ActiveX Reference Parameter to the callee and pass the sequence context of the calling sequence (ThisContext) as the argument. In the callee, you may access any property of the calling sequence by using the API methods SetValNumber, SetValString, SetValBoolean, etc. You could use the ActiveX adapter configured as follows:
- ActiveX Reference: Parameters.SeqContext (This would be the name of the parameter you added)
- Automation Server: TestStand API
- Object Class: PropertyObject
- Action: Call Method
- Method: SetValNumber (or SetValString, SetValBoolean, etc.). You'll need to give the correct path to the property you are trying to access as the lookup string. For i.e., if the calling sequence local variable is called "MyVariable", the property path would be "Locals.MyVariable" (including the double quotes).
This last method will work even if the subsequence is called in a New Execution.
The best method will really depend on what you are doing as previously described.
Regards,
Carlos Leon