Field mapping and value mapping

Field mapping defines the mapping between the fields in the source file and target file, as shown in the following figure.

Note  

  • The Target field cannot be empty.
  • The Source and Target fields must already exist in the table.
  • If there is a structure field mapping and you are not in Batch Update mode, both fields must have the exact same structure definition.
  • Array of structure and structure fields are not supported when in Batch Update mode.
  • The M2 and alias table are not supported in Batch Update mode.
  • You cannot use jscallback in Batch Update mode.

Value mapping defines the value mapping for each mapped field.

Note  

  • For the fields that do not have a value mapping defined, the default is direct value copy.
  • You can define multiple value mappings for the same field.

The following table describes each column in the Value Mapping Definition tab.

Column

Description

Target value mapping field

The field from target field that needs to define value mapping.

Mapping Type

The following three types are supported:

  1. fixedValue: target field value = the fixed value defined in “Target Value” column. The supported fixed value are number, string, datetime, and Boolean. You cannot specify an expression in a fixed table, nor a fixed value for structure and array field type.

  2. sourceField: target field value = source field value defined in “Target Value” column.

  3. jsCallback: target field value = a JavaScript script to dynamically set the value. Three keywords ($sourceTable, $targetable, $value) can be used if the direct script code is written in the Target Value column:

    • $sourceTable, $targetTable reference the field value in the source table field and the target table field, respectively as shown in the following example:

      var status = $sourceTable[“rcStatus”],$targeTable[“rcStatus”] = “open”
    • $value is used to specify the current target field value as shown in the following example:

      $value=vars.$G_user_role retrieves the value from another variable.

    jsCallback can also support directly calling a JavaScript function defined in Script library, such as the following:

    lib.UpgradeScript.migrateData($sourceTable,.$targetTable);

Condition

If the condition is true, then the value mapping is applied during the migration. The condition expression supports the following:

  1. Arithmetic operators: >, <, >=, <=, =, ~=
  2. Logical operators: or, and
  3. The “null” keyword can be used as a null value in the formula.

Target Value

Depending on the Mapping Type setting, Target Value can be a fixed value string, or a source field name or a JavaScript script.