Calling another activity
Use the Call instruction to cause the current activity to find another specified activity and execute it. When that activity completes, control returns to the calling activity.
The calling activity can pass parameter values to the called activity in two ways.
- Only parameter values entered are passed if the Pass current parameter page check box is not selected in the Steps tab.
- The parameter page is shared between the two activities if the Pass current parameter page check box is selected in the Steps tab. This approach is known as call-by-reference.
See Call instruction parameters for information about the parameters this call can take.
You can also pass a reference to a clipboard page as a parameter. The called activity can then use this Page Name parameter as if it were the clipboard page. See Passing Page Name parameters.
Notes on Out parameters
The Call instruction in an activity examines the In/Out value of each parameter in the called activity:
-
If the parameter is declared as
Out
and the entire parameter page of the current activity is shared with the calling activity, then the value of the Out parameter in the call may be of the form param.name. If the called activity updates the output parameter, the resulting value is available on the parameter page of the calling activity. -
Note: If a parameter is declared as
Out
and the value of the parameter in the Call panel is itself a property reference, then traditional call-by-reference semantics applies. That is, if the called activity updates the parameter value, the value of the property itself is updated.
In a chain of calling activities (activity Alpha calls Beta which calls Gamma), a
property passed by reference from Alpha to Beta can also be passed by reference to Gamma,
and changes to the
Out
parameter made within Gamma can be passed all the
way back to Alpha. This corresponds to the behavior of call-by-reference in many programming
languages.
Results
The system uses rule resolution to locate the activity. It then constructs or shares a parameter page and transfers control to the activity.
Accessing iteration values in a called activity
If an activity step involving iteration contains a Call instruction, special parameters are added to the parameter page and can be used within the called activity to access iteration details. See Activity Form — Completing the Steps tab — Entering loops.
Asynchronous execution
As an alternative to the Call instruction, you can use the Queue instruction to execute an activity asynchronously in parallel, in a child requestor.