Using Scope in a Loop
Updated: November 21, 2013
This topic describes using scope in Microsoft Azure BizTalk Services.
At the bottom of the Transform Design surface, the MapEach Loop scope hierarchy is displayed in the breadcrumb trail. The current MapEach Loop scope is the last item in the breadcrumb trail. When scope is set in a MapEach Loop, the breadcrumb trail is updated to reflect the current hierarchy. In the following example, Employee Mapping is the last MapEach Loop in the breadcrumb trail so it is the current set scope:
The MapEach Loop, ForEach Loop and Create List Map Operations have a container. The child objects are grouped together in the container. Items within the container are in the scope of the container and are executed within the scope of the container. An inner container is a child of the outer container. When a container is selected, a solid line is displayed around the container. In the example below, Dept Mapping is selected so its container has the solid line:
Each container can be collapsed and expanded in two ways:
Select the container and press the SPACE bar.
Click the minus (-) to collapse and the plus sign (+) to expand.
Collapsing the container automatically unsets the MapEach Loop scope. Adding Map Operations to a container can only be done when the container is expanded. Modifying links can be done when the container is collapsed or expanded. In the example below, Employee Mapping is collapsed and the Containing Scope property automatically goes to its parent node, which is Dept Mapping:
When the MapEach scope is set, the container header is highlighted. These colors are modified using the following steps:
Go to the Tools menu and select Options.
Expand Transforms Designer and click Colors & Fonts.
Select Working Scope Header Background to change its color.
When linking a repeating record in the source document to a repeating record in the target document, a MapEach Loop is needed. Creating these links from each source node to the target node is often time consuming. As a result, BizTalk Services includes Direct Link functionality.
Direct Linking is simply copying from an input node to an output node, with no other processing. Direct Linking is also used when linking non-repeating records; which does not require a MapEach Loop.
Loop Map Operations - Usage and Examples describes the Direct Link functionality.
Container Scope is per Page. When scope is set on a MapEach Loop in Page 1, clicking Page 2 sets scope on Home in Page 2.
When you click a container, the source and target node links are highlighted in green. In the example below, the Company Mapping, Dept Mapping, and Employee Mapping scopes are set. The breadcrumb trail shows the MapEach Loop hierarchy. Employee Mapping is the last item in the breadcrumb trail and is therefore the current scope. The Employee Mapping node is highlighted in green:
On the Tools menu, select Options.
Select Transforms Designer.
To turn off the highlighting feature, select General and clear the Highlight Propagation option.
To modify the highlighting colors, select Colors & Fonts.
When a child loop is selected, the Containing Scope property is updated with the Label name of the parent scope. In the example below, Dept Mapping is selected and the Containing Scope property displays Company Mapping, which is the parent node:
Clicking Home in the breadcrumb trail puts the scope at the Page. No scope is set and the Containing Scope property displays None:
Map Operations are movable using Cut/Copy and Paste. Links are not movable using Cut/Copy and Paste. If you move a Map Operation using Cut/Copy and Paste, the links are removed.
To move Map Operations and their links, use Ctrl + Click to select the items to move. Ctrl + Click cuts the items and then you paste to the desired location. Map Operations and links cannot be dragged and dropped.
To exit a MapEach Loop scope, do any of the following:
Unset scope . This option moves the focus up one MapEach Loop scope in the hierarchy.
In the example below, scope is set:
Then, the Employee Mapping MapEach Loop scope is unset. The Dept Mapping MapEach Loop scope is the last item in the breadcrumb trail and is the current scope:
Click any parent scope in the breadcrumb trail. For example, click Dept Mapping in the Breadcrumb Trail:
Set a different scope.
For the best practices when working with Container Scope and a Scope Example, refer to the following topics: