Using Scope in a Loop - How To

 

Important

Microsoft Azure BizTalk Services (MABS) is being retired, and replaced with Azure Logic Apps. If you currently use MABS, then Move from BizTalk Services to Logic Appsprovides some guidance on moving your integration solutions to Logic Apps.

If you're brand new to Logic Apps, then we suggest getting started here:

This topic describes using scope in Microsoft Azure BizTalk Services.

Scope Transform Design Area

Scope Design Surface

At the bottom of the Transform Design area, 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:

Breadcrumb Trail

Container

The MapEach Loop, ForEach Loop, and Create List 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 following example, Dept Mapping is selected so its container has the solid line:

Container

Collapse and Expand

Each container can be collapsed and expanded in two ways:

  • Select the container and press the SPACE bar.

  • Select 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 following example, Employee Mapping is collapsed and the Containing Scope property automatically goes to its parent node, which is Dept Mapping:

Minimized

Container Header

When the MapEach scope is set, the container header is highlighted. These colors are modified using the following steps:

  1. Go to the Tools menu and select Options.

  2. Expand Transforms Designer and select Colors & Fonts.

  3. Select Working Scope Header Background to change its color.

  4. Select OK.

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.

Page

Container Scope is per Page. When scope is set on a MapEach Loop in Page 1, selecting Page 2 sets scope on Home in Page 2.

Highlight Propagation

When you select a container, the source and target node links are highlighted in green. In the following example, 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:

Scope Indications Links

To modify or turn off the highlighting

  1. On the Tools menu, select Options.

  2. Select Transforms Designer.

  3. To turn off the highlighting feature, select General, and clear the Highlight Propagation option.

  4. To modify the highlighting colors, select Colors & Fonts.

Containing Scope

When a child loop is selected, the Containing Scope property is updated with the Label name of the parent scope. In the following example, Dept Mapping is selected, and the Containing Scope property displays Company Mapping, which is the parent node:

Containing Scope Property

Home

Selecting Home in the breadcrumb trail puts the scope at the Page. No scope is set and the Containing Scope property displays None:

Home in Breadcrumb Trail

Cut, Copy & Paste

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.

Exit a Scope

To exit a MapEach Loop scope, do any of the following:

  • Unset scope Unpinned Scope. This option moves the focus up one MapEach Loop scope in the hierarchy.

    In the following example, scope is set:

    Containing Scope Property

    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:

    Item in Scope and Next Item Unset Scope

  • Select any parent scope in the breadcrumb trail. For example, select Dept Mapping in the Breadcrumb Trail:

    Scope Exit Breadcrumb Trail

  • Set a different scope.

In This Section

For the best practices when working with Container Scope and a Scope Example, refer to the following topics:

Transforms/Maps Best Practices

Loop and Scope Examples in map or transforms

See Also

Loop Map Operations - Usage and Examples