Separating one source field into multiple target fields
In a data mapping, you can separate a source field into multiple target fields. For example, map the customerName field to the FirstName and LastName fields.
For the source field, you must know what type of content is in each part of this field, the order and index of each part of the content, and the separator between parts, such as a space or comma.
- In the Source panel, select the field that contains the content you want to separate.
- In the Target panel, select the first field you want to map part of the source field’s content to, and then for the remaining target fields, press and hold the Ctrl key when you select them.
The Data Mapper automatically changes the mapping type to Split. When you are done selecting target fields, you should see lines from the source field to each of the target fields. This example shows the customerName field mapped to two target fields – FirstName and LastName:
- In the Scriplets panel, a Split action is automatically added to the Source field. Select which separator character should be used to separate the source field values. The default value is a space.
- In the Scriplets panel, under Targets, verify that the target fields are in the same order as the corresponding content in the source field. To move a field, you can either update the index values of the target fields, or use the mouse cursor over the vertical dots on the left side of the field and click the right mouse button to “grab” the field and move it to the desired location before releasing the right mouse button.
- To preview the data mapping results, click the Show/Hide test preview button in the Scriptlets window. This displays a text input field on the source field and a read-only result field on the target field. Enter a value in the source field’s text field, then click the Run preview test button to display the mapping result in the read-only field on the target field:
- If you reorder the target fields or add a transformation to a target field, then the result target fields reflect this. If the Data Mapper detects any errors, it displays informative messages at the top of the Scriplets panel.
- Hide the test preview by clicking again.
- To confirm that the mapping is correctly defined, toggle the view buttons to display the defined mappings in list view. A mapping that separates the values of one source field into multiple target fields looks like this:
- You can also preview mapping results in the list view. Click the Show/Hide test preview button and enter text as previously described. The preview fields appear for only the selected mapping. Click another mapping in the table to view the preview fields for it.