Create a Router statement to check the phone numbers. Add Option statements that check if a phone number type is a mobile, work, or home phone number.
In the
XMap
view, add a Repeating Group statement to the
Patient_Claim
XMap. To create a Repeating Group, in the XMap editor grid select the
Doctor to Claims
Repeating Group. Right-click and select
New
Repeating Group
.
To name the Repeating Group, double-click the
Name
field and type the name
SortPhones
.
To evaluate the phone numbers in the input, drag the
Phone
node into the
Input
field of the Repeating Group.
The following image shows the Repeating Group statement:
To filter phone numbers by type for each doctor, create a Router. In the XMap editor grid, select the
SortPhones
Repeating Group, right-click and select
New
Router
.
The following image shows the XMap editor with the Router statement:
To name the Router statement, double-click the
Name
field and type the name
PhoneType
.
To filter mobile numbers, create an Option. Right-click and select
New
Option
.
To name the Option statement, double-click the
Name
field and type the name
Mobile
.
To make the
Mobile
statement check that the type of phone number is a mobile number, drag the mouse from the
@type
input schema node to the
Condition
field in the
Mobile
statement. To define the condition, perform the following steps:
To open the XPath Expression editor, click the arrow to the right of the
Condition
field.
Use the XPath Expression editor to edit the expression to the following syntax:
@type="mobile"
The following image shows the XMap editor with the Option statement:
Drag from the
Phone
input schema node to the
MobilePhone
output schema node.
The XMap editor creates a Map statement named
Phone to MobilePhone
in the grid under the
Mobile
statement. The statement passes the first instance of the node to the output XML. The
Input
field contains the following expression:
.[1]
. We want to select the current node, not just the first instance. In the next step, we correct the expression in the
Input
field.
To correct the
Input
field, use the XPath Expression editor to edit the expression to be a single period.
The corrected statement passes the mobile phone number in the current node to the output XML.
The following image shows the XMap editor with the completed Option statement and Map statement:
To filter work numbers, copy and paste the first Option statement to create another Option statement. Select the
Mobile
Option statement that you created, right-click and select
Copy
. Select the
PhoneType
Router statement, right-click and select
Paste
.
A copy of the
Mobile
Option statement appears nested under the Router. The Option statement has a red highlight to indicate that you must correct the fields in order for the Option statement to work. For example, two Option statements cannot have the same condition expressions.
To rename the copy of the Option statement, double-click the
Name
field and type the name
Work
.
To make the
Work
statement check that the type of phone number is a work number, edit the
Condition
field. To define the condition, perform the following steps:
To open the XPath Expression editor, click the arrow to the right of the
Condition
field.
Use the XPath Expression editor to edit the expression to the following syntax:
@type="work"
Rename the copied
Phone to MobilePhone
Map statement nested in the grid under the
Work
Option statement. To rename the statement, double-click the
Name
field and type the name
Phone to WorkPhone
.
To pass the phone number to the correct node in the output, drag the
WorkPhone
node to the
Output
field of the
Phone to WorkPhone
statement.
This statement passes the work phone number to the output element for the work phone number. If you did not edit the statement, the transformation would pass the work phone number to the output element for the mobile phone number.
To filter other telephone numbers, create a Default statement. Select the
PhoneType
Router statement, right-click and select
New
Default
.
To name the Default statement, double-click the
Name
field and type the name
Other
.
To pass the phone number to the other phone node in the output, first copy and paste the previous Map statement to create another Map statement. Select the
Phone to WorkPhone
statement that you created, right-click and select
Copy
. Select the
Other
Default statement, right-click and select
Paste
.
The XMap editor creates a Map statement named
Phone to WorkPhone
in the grid underneath the
Other
statement.
Rename the copied
Phone to WorkPhone
Map statement. To rename the statement, double-click the
Name
field and type the name
Phone to OtherPhone
.
To pass the phone number to the correct node in the output, drag the
OtherPhone
node to the
Output
field of the
Phone to OtherPhone
statement.
This statement passes the other phone numbers, such as the home phone number, to the output XML.
The following image shows the XMap editor with the completed Router, Option, Default, and Map statements:
To save the transformation, in the Developer tool click