Creating Mapping Scripts

  To create a mapping script:

  1. From the Workflow tab, select Data Load Mapping.

  2. Optional: Select the desired location.

  3. Select either the Like, Between, or In tab.

    Mapping scripts are not available for “Explicit” and “Multi-dimension” mapping types.

  4. Select the Source Value.

  5. In Target Value, select one of the following:

    • For a Jython based mapping script, enter #SCRIPT.

    • For a SQL based mapping script, enter #SQL.

      Note:

      For SQL based mappings, FDMEE specifies the special value #SQL to the “Target Value.” For this reason, this field cannot be used to specify a value of "IGNORE", which is otherwise used to set the VALID_FLAG to Yes and No. For SQL based mappings, you must include the VALID_FLAG in the SQL script and specify the value of "I" based on the user selected criteria.

  6. In Rule Name, enter the data rule name for the mapping.

  7. Click Save.

    The Script Editor icon (Image shows Script Editor icon) is enabled.

  8. Click the Script Editor icon.

  9. From Edit Script, enter the mapping script, and click OK.

    For example the following Jython based mapping script checks when the first two characters of the account equals 11 and the entity equals 01. When a match occurs, then the target is set to Cash2 and the target amount is set to 0. In addition, the script also updates the attribute1 column in the TDATASEG table. (See TDATASEG Table Reference). This script uses the fdmResultMap object (see Using Jython Objects with Mapping Scripts).

    Image shows Edit Script screen

    In the next example, a SQL script can be used where logic is implemented in a SQL CASE statement. The CASE statement is used in the SET command of the internal UPDATE statement. he mapping statement below is converted to the UPDATE statement listed

    Image show Edit Script screen with SQL based mapping script.
    UPDATE TDATASEG  
    SET ACCOUNTX =
    CASE
    		WHEN ACCOUNT LIKE ‘L%’ AND ICP = ‘000’ THEN ‘A4140‘
    		WHEN ACCOUNT IN (‘110’,’120’,’130’) THEN ‘A100’’
    		ELSE ‘A’ || ACCOUNT
    END
    ,DESC1 = COALESCE(DESC1, ACCOUNT || ‘.’ || ICP)
    WHERE ACCOUNT …..