Skip to main content

Mapping

The actual copying of source data to target fields is handled by the Mapping page of the import app. Not all fields in the source data need to be mapped, so you can choose those fields which are meaningful for the data import.

There are three types of mapping relationships:

  • Direct: the source value is copied directly to the target field
  • Translations: the source value is translated, then copied directly to a target field
  • Scripts: the source value is processed by Rule Scripts using the Rules interface; this exposes the underlying Functions assets for parsing and processing the source data

Imports Source Mapping

The Mapping grid presents a list of all incoming source fields. The Target column is used to map a column to a field in the target data store. After choosing a Target, additional options are available in the Transformations column for accessing the Script and Translate tools.

Direct

Direct mappings are those that require no translation or parsing of the incoming data, and are mapped "as-is" to the target field.

Import Mapping Direct

Click on Choose target to display the drop-down of all target fields

In the Target column you can select the target field from a drop-down. The list of fields presented is derived from the Target table chosen on during the Add Import Wizard, and also at the Details page.

tip

Use the < > arrows above the Mapping grid to navigate forward/backward through the source data to preview the source and converted target columns.

note

You can skip any source field that is not needed in the target store. The unused fields can remain in the Mapping grid, or you can remove them by pressing the X at the header of any row. Fields can be re-added using the ADD FIELD button on the top of the Mapping grid.

Imports Mapping Target

The above shows our four incoming source values being mapped to their similarly named (but not necessarily the same) target values. After selecting a Target for any given row, the additional tools for script and translate become visible.

Translations

Translations provide a simple table whereby you can map a list of incoming values to desired translated values. In our Departments example, the translation table for the Status field would be as follows:

Status (source field)Inactive (target field)
Activefalse
Inactivetrue
note

The above feels backwards as the source Status of Active needs to map to a target's Inactive value of false, and Inactive maps to true. Each case will be different based on the intent and context of the field.

Imports Mapping Translate

Press the Translate button to open the Translate dialog

Use the Translate dialog to create one-to-one mappings for each possible source value. The columns on the left under "Source Value" have been pre-populated with every distinct value found in the source file. Use the fields under "Target Value" to select the translated value.

The system knows what kind of data is supposed to be in the target field, so will display a drop-down selection based on the expected data type. For boolean (true/false), the menu will display the same (as shown above). For lookup fields or those that have enumerated values, the drop-down will show the available choices. If the target is simply a text field, you can enter any value into the Target Value.

important

The pre-populated values on the left are based on observing what's in the current source file. Its entirely possible that the source file doesn't contain every possible value (e.g. what if none of the current Departments was Inactive, we'd not know of its existence.) To that extent, when first creating imports, you may want to stage a file that contains at least of of every possbile value for fields which will be translated.

The default value choice is always listed on the bottom of the list of distinct source values. This acts as a placeholder for any row that does not match the translation table (such as in the note above suggesting you insure all values are present when first importing a file.) In this example, if a new Status of Pending appeared one day, it would fall to the default value row and be translated to its respective value.

Scripts

Scripts provide full access to the Rules interface, which exposes Functions to allow total parsing and manipulation of the source data. Our Departments example doesn't contain any complicated data which could use a script, so lets look at a different example, one of importing from an employee source file:

Imports Mapping Employee

Employee import showing use of Script and Translate tools, noted by the hi-lighted button under Transformations; those rows with active scripts are in blue, active translate tables are in green.

Function Examples

Date Function Example

Lets take a look at how a date field uses a script to convert from one format to another.

Imports Mapping Translate Date1

Press the script button on one of the dates rows to show the Script Editor tool

By default, the script tool shows the SET operation and in this case is applying the Last Hire Date to Hire Date, basically the same end-result as a direct copy (this is pre-filled in as you've already mapped the two fields together at the prior screen)

Next, we fill-out the formula editor with a function which will convert the date into the format we need.

Imports Mapping Translate Date2

Here are the steps to completing the date format formula:

  1. We search for date in the search box in the upper right to search functions and data fields for things like "date"

  2. Drag (or type) the FORMAT_DATE function into the formula editor's right-side cell, overwriting the Last Hire Date field

  3. You'll now see the FORMAT_DATE function listed on the row below along with its three input parameters: date, mask and target mask

  4. Drag (or type) Last Hire Date from the search results into the first parameter of the FORMAT_DATE function.

tip

In most cases with dates and other common conversions, the function will have a few default values that it will try automatically, so in this case the mask and target mask are optional and can be left blank. The function will try a few common ones and usually make the correct decision. If needed in this case, the mask could be entered as %m/%d/%Y which represents the source values such as 04/11/2017 and the target mask would be the standard SimplyWork date format of %Y-%m-%d which corresponds to a format of 2017-04-11. No quotes are used when entering constant values such as a mask.

The completed function is:

SET[ HireDate = FORMAT_DATE(Last Hire Date, )]

SET[ HireDate(3) = FORMAT_DATE(2)(Last Hire Date(1), )]

Which means: take the value from the source data's Last Hire Date (1) as the first parameter input into the function FORMAT_DATE (2); store this result in the HireDate (3) field of the target (Employees.HireDate).

Adding Fields

Fields can be added using the ADD FIELD button on the top of the Mapping grid. There are a couple of use-cases where you might want to add a field:

Use-CaseNotes
Restore deletedIf a previously unused field was deleted, this allows you to put it back into the list
Add TwiceThere are times when a single source field might be the input to multiple target fields; for example, a hypothetical source value titled "GL-ALLOCATION" could be composed of a {GL-DEPT} combination, such that you'd pull the first component out to populate a CostCenter and the latter component for a Department using a SPLIT function.
Add VirtualIn this case, choose No source field from the Add Field drop-down; this allow you to insert a Rule Script which could pull from any source field (or no source field) and still generate a target value. A common use-case may be to seed default values into the target which are not dependent on any source value (e.g. Imported = 1 assuming there was a target column titled "Imported")
note

The field list order is not significant, so if a field is added at the bottom, its mapping is not affected by the position as each row is processed independently of any other row.

Previewing

Use the < > arrows at the top of the Mapping grid to navigate forward or backwards through the source data. Each row's raw source field, along with the translated target value, are presented. This is useful to insure the target value appears as intended.

Imports Mapping Preview

info

While the tools here show the boolean type fields as true/false, internally they are stored in numeric format: 1 and 0 so the translate tool above converts Active to false as the Target field of "Inactive" is a boolean datatype. However, false is further translated internally to 0 before begin stored in your data stores. You can use the two variants interchangeably through out the system as the data stores will accept either format.

Next we'll look at scheduling imports to run automatically.