Use the grid area of the XMap editor to define statements that map the input XML elements to the output XML elements. Create and edit mapping statements in the grid. Define the context, condition and expected input and output for a mapping statement. You can add variables to mapping statements.
The following figure shows the mapping statements in the grid:
The grid contains the following mapping statements:
Grid row 1, Repeating Group statement named Company
The Company statement is a Repeating Group statement. It repeats for each the Company element. The statement provides a context for the rest of the statements in the grid. For each company, the Data Processor transformation evaluates the child statements.
Grid row 2, Repeating Group statement named Department
The Department statement is a Repeating Group statement. It repeats for each Department element. The statement provides a context for the rest of the statements in the grid. For each department, the Data Processor transformation evaluates the child statements.
Grid row 3, Map statement named NametoDepartment
The NametoDepartment statement is a Map statement. It maps the Name element to a variable $deptName.
Grid row 4, Repeating Group statement named MatchOrganization
The MatchOrganization statement is a Repeating Group statement. It has an output expression:
tns0:Organization[tns0:Department=$deptName]
The statement finds the Organization element in the output that contains a Department child element with the value in $deptName. Or, if the Department element does not exist, the element is created.
Grid row 5, Repeating Group statement named EmployeeToWorker
The EmployeeToWorker statement is a Repeating Group statement. It repeats for each Employee element.
Grid row 6, Router statement named Employee
The Employee statement is a Router statement. The statement has no input or output.
Grid row 7, Option statement named EmployeeToMgr
The EmployeeToMgr statement is an Option statement. The Option statement contains the following condition:
tns0:Role="Manager"
.
When the Role is Manager, the statement is true, and the Data Processor transformation evaluates the statements nested inside the Option statement.
Grid row 8, Run XMap statement named EmployeeToWorker
The EmployeeToWorker statement is a Run XMap statement. It calls the XMap_EmployeesToRoles XMap to pass the Employee elements to the Manager type.
Grid row 9, Default statement named EmployeeToWorker
The EmployeeToWorker statement is a Default statement. The Data Processor transformation performs the child statements when the employee role is not a manager.
Grid row 10, Run XMap statement named EmployeeToWorker
The EmployeeToWorker statement is a Run XMap statement. It calls the XMap_EmployeesToRoles XMap to pass the Employee elements to the Worker type.
Grid row 11, Map statement named IncrementEmployeeCount
The IncrementEmployeeCount statement is a Map statement. It calls the Data Processor transformation to add 1 to @noOfEmployees for each Employee that it iterates. The Map statement contains the following input expression: