Field Mapper Step

The Field Mapper maps source data to destination data and convert field value types with advanced functions.

Praise Magidi avatar
Written by Praise Magidi
Updated in the last 15 minutes

When transferring data from source system to a target/destination system, there is often a difference in the data schema, particularly in field naming. For example, in your CSV input file, a column could be named Address, while in your target system, the corresponding field might be called Primary Address.

In traditional programming, you might make a data mapping function to convert from one data structure to another, perhaps using something like AutoMapper, if you've worked in c#.

In Synatic, there is a Field Mapper Step to help with this task. The Field Mapper Step can map from a source field name to a target field name, convert data types, and perform templating, combining, and formatting field values through Handlebars.

Adding the Field Mapper Step

To add a Field Mapper step in a flow, follow the below instructions:

1. Click on the highlighted icon as shown in the below image.

2. The below page will appear. Select or search for a step to pull out the source data. Click on the Mapper tab and select Field Mapper as shown in the image below.

Configuring the Field Mapper Step

Illustrated in the below image is the configuration that is available in the Field Mapper step. To add new fields, click on the plus (+) icon outlined in the image below. Click on the tick button highlighted in yellow on the right side of the screen to add the buttons or click the (x) button to remove.

Clean Record checkbox

  • Enabling Clean Record will create a new "clean" record, with only the new fields specified in the "To Path" column of the mapping table.

  • Disabling Clean Record will append the new fields specified in the "To Path" column of the mapping table to the existing record.

Mappings Table

The mapping table has 5 columns. Not every column is needed for mapping; it all depends on the object to achieve.

From Path

The From Path column specifies a path to an existing field on the record to map from. Dot notation can be used to specify sub-properties if they are needed. If a From Path is specified, there is no need to specify a From Value.

From Value

The From Value allows the use of Handlebars template to specify a value to map to a new field (specified in the To Path). This allows combining values, formatting values, and more.

To Path

This field is mandatory. This specifies the path or name of the new field to map to.

Default Value

This is a default value to use in the new field if there is no source field found on the input record.

Type

This specifies the data type of the newly mapped value. Synatic will try parse and convert where possible.

Example

For the examples that follow, our input record looks like this:

{
"Company": "Dees Deco",
"ID": "123",
"Availability": "Yes",
"Quotation": "100",
"Flower": "Red Roses"
}
}

Mapping to a clean record with new field names

The above input records are being mapped to a totally new simplified schema that looks like this:

{
"Company Name": "Dees Deco",
"Company ID": "123",
"Available": "Yes",
"Quote": "100",
"Flower Type": "Red Roses"
}

The mapping table and options to achieve the transform would look like this:

Using the From Value template

In this example, a new field that is a "New Company Name" for certain display purposes will be created. This would be a combination of the Company and ID. So for our input example at the top, a field called New Company Name is created and the value to be "Dees Deco with ID 123". To achieve this, we can use Handlebars templates and the From Value mapping column:

The "Clean Record checkbox" is not selected in this case, as this new field should be appended to the existing record. The Handlebars template use "record" before referencing the fields of interest. {{record.Company}} with ID {{record.ID}}

The appended Record is shown in the image below:


See Also

Read more about Super Mapper.


Useful Tutorials

Revisit the Getting Started page for a refresher.

Read more about Steps here.

Did this answer your question?