What Is Scope?
When you invoke a service in a DSP, notice that you do not specifically state which parameters you want to pass to it. Instead, the service automatically receives an IData object containing all the variables that are in the DSP’s current scope.
Scope refers to the set of variables upon which a DSP can operate directly. When a DSP is initially invoked, its scope encompasses the set of name=value pairs it receives (via GET or POST) from the requestor. For example, if you were to request a DSP with the following URL:
http://rubicon:5555/ORDER_TRAK/getorderinfo.dsp?action=shipinfo&oNum=00011520
Its initial scope would look like this:
After you execute a service with the %invoke% tag, the scope automatically switches to encompass the set of variables returned by that service. For example, if the DSP in the preceding example invokes a service that returns shipping information, that DSP’s collection of variables would look like this after the service executes. Note that just the variables returned by the service are within scope.
Conceptually, you can think of a DSP as maintaining its run-time variables in a set of nested containers. It starts with a container that holds the variables submitted by the requestor. When a service is invoked, it puts the results from the service in a new container inside the initial container—the new container comprises the current scope. If another service is invoked while that container is open, the variables returned by the from the service are put into another container, which is placed inside the previous container, and so forth.
Note:
Besides the %invoke% tag, certain other tags (e.g., %loop%) implicitly switch scope. This behavior is noted in the tag descriptions in the .