Some mappings require several steps to achieve the desired results. This section describes some complicated mapping scenarios and how to achieve the desired mappings using the tools available.
In some situations, you may wish to set an element explicitly to nil. One situation is when you wish to insert a row into a database table and you wish to supply a NULL for one of the columns. To set an input element explicitly to nil, perform the following:
The element’s formula becomes blank and is not editable (because nil is the value of the element) and the explicit nil qualifier icon appears next to the statement

.
You may have multiple items in the Scope Variables that you wish to map to one repeating element in the Function panel. For example, you may have multiple formats for customer records and you wish to create a single, merged mailing list containing all customers in one format. In this example, the schemas are the following:
4.
|
Select the Address element and click the XPath Formula Builder icon in the Input tab toolbar. In the XPath Formula Builder, drag a concat() function into the XPath Formula field. This function is used to concatenate the three elements in the Record element in the Scope Variables area to one Address element in the function’s input. 
|
Drag the $current()/Address/state element into the
<< string2 >> placeholder in the
concat() function. Then, add a comma to the end of the function to include a third string to concatenate. Drag the
$current()/Address/zip element into the position of the third string in the
concat() function.

5.
|
Click Apply, then click Close to dismiss the XPath Formula Builder dialog.
|
You may need to convert a flat list of items into a more structured list. For example, you may have a list of all orders that have been completed. You may want to organize that list so that you can group the orders placed by each customer.
1.
|
Choose the repeating element in the function input schema that holds the grouped data. In this example, that element is Orders. Right-click on this element and choose Statement > Surround with For-Each-Group... from the pop-up menu. This is a shortcut to create a For-Each-Group statement with the Orders element as a child element and a Grouping statement to contain the element you wish to group-by. 
|
Adding the Grouping statement creates the $=current-group() element in the Scope Variables area. The Grouping statement creates the list grouped by the desired element, and the
current-group() function allows you to access the items in the
Requests repeating element that correspond to the group that is currently being processed.
4.
|
Map the current-group() element in the Scope Variables area to the repeating element Order under the Customer element in the Function panel. 
|
This creates an item in the Order list for each item in the current customer ID group that is being processed. The mapping wizard asks if you wish to map items with the same name in the current group and the orders group.
5.
|
Map the remaining element from the current-group() element into the desired element in the For-Each group. In this case, quantity would map to Quantity automatically, and Item must be mapped to ItemName. 
|
You may need to merge two lists that have corresponding items. For example, you may have a list of student IDs and a list of grades, each grade corresponds to the student ID in the same position in the student ID list. In this example, the schemas are the following:

4.
|
Merging two parallel repeating structures requires two variables. The mapping wizard prompts you to name these two variables. One variable is to hold the position number of the current item being processed, and the other variable is to hold the item in the second list that corresponds to the position of the item in the first list. Create the variables with the default names supplied by the mapping wizard, or choose your own names for these variables. Click Finish to proceed. 
|
The $=[index=] element contains the XPath formula
position() to set the element with the current position number of the list item being processed. The
$=[item=] element contains a statement to retrieve the item in the second repeating element that corresponds to the position of the item in the first list that is currently being processed.
5.
|
Map the ID element to the StudentID element in the function arguments. 
|
6.
|
Map the $=item/Grade element to the Grade element in the Function panel. 
|
In some situations, the datatype of a Scope Variables element may be undefined. In these situations, you may know the datatype of the element, and you can coerce the element into a specific type. The Coercions button in the Input tab toolbar allows you to create and manage your coercions.
The following example illustrates a schema with an element defined as the "any element" datatype. The schema is for a generic incoming message that can have any type of body. In the example, however, the any element is coerced into an Order type so that it can be mapped to a choice element.
The following procedure describes how to coerce the Body element of the incoming message into a specific datatype and map it to a choice element.
The Coercions dialog allows you to manage all of your coercions for a function in one dialog. You can create, modify, or delete coercions for any element in the Scope Variables schema using this dialog, not just the currently selected element. If you are creating a coercion for an element that is not currently selected, use the XPath field to specify the location of the element.
3.
|
Map the Name element to the Name element in the Function panel. Then, map the coerced Order element to the choice element in the Function panel. 
|