Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In this step you will create a transformation map that will do the following:

  • Select records from the Employee file (XEMPLOYEE) based on the employee codes from the file iiiTUTEMPNO.csv. Your processing sequence will receive the CSV file as an email attachment
  • Write the selected employee information to the file iiiTUTEMPDET.xml
  1. In the Navigator, select Definitions, Transformation maps
  2. Use the Image Modified button on the toolbar to create a new Transformation map with the following details:

    ID

    iiiTUTMAP03

    Description

    Employee details XML from CSV selection list.

    Map Type

    Unspecified Type

    Restartable

    Yes

    Status

    Active

  3. Save the transformation map.
  4. Click the Image Modified button to open the MapForce mapping tool.
    You may get a warning message stating that LANSA Composer supports a subset of MapForce mapping functionality.
    Click Continue to proceed to MapForce. You will see an empty map.
  5. To insert the Request CSV file, choose Insert Text File using the Insert menu. Then select Use simple processing for standard CSV ... and press the Continue button.
    Image Modified
    Image Modified
  6. In the Text import / export window, click the Input file button. Use this dialog to navigate to select the file 

  7. Code Block

  8.      \\<SRV400>\ifs\LANSA_Composer_licpgmlib\lic\Tutorial\iiiTUTEMPNO.csv

     which you created earlier.

  9. Check the First row contains field names checkbox.
  10. In the Text enclosed in radio button group, select Not. Your selection will look like this.
    Image Modified
  11. Press OK. Mapforce will display the file iiiTUTEMPNO.csv visualization.
    Image Modified
  12. Insert the Database element using the Insert Menu.
    Image Modified
  13. Use the existing ODBC connection which you created in an earlier module.
    1. Login using your workshop IBM i User ID and Password. You may be prompted for a number of logins.
    2. Upon successful connection to the database, you will get a Select Tables, Views to Insert dialog.Image Modified
    3. Expand the list of libraries, schemas, or collections using the drop-down menu next to the small arrow.  After selecting the library, schema or collection containing the required file (for example, LICLICLIB or LC_DTA on a Windows server), locate the file XEMPLOYEE and select it using the check box.

      Note
      titleNote
      The library name should be the same one used in the database connection string used when creating the Database configuration previously.
  14. Code Block

    1. jdbc:as400://<SRV400>/<LIBRARY>;naming=sql;errors=full;date
    1. format=iso;
    1. true;translate
    1. binary=true



      Image Modified
  15. Click OK to return to the main window. You will see the XEMPLOYEE table Visualization displayed.Image Modified
  16. From the Insert menu, insert the XML Schema/File.
    Image Modified
    1. Use the Insert menu, XML Schema/File ... navigate to the . . . .\Tutorials folder and select schema file iiiTUTEMPDET.dtd file.
    2. Use the Browse button to select the XML file iiiTUTEMPDET.xml

      Your XML file structure will be displayed in the map.c .  Rearrange your mapping screen to look like this.Image Modified
      The map functionality required will select Employee Details from the database only when the Employee Number is listed in the CSV file.
  17. From the toolbar or Insert menu, insert an SQL-WHERE Condition.
  18. Connect the XEMPLOYEE table to the SQL-WHERE table input. This will open SQL-WHERE properties window.Image Modified
  19. In SQL-WHERE properties window, type in the select criteria:
    On Windows


  20. code


  21. xEmployeeIdentification =

  22. :inEmpNo


    On IBM i


  23. code


  24. xEmployID

  25. =

  26. :inEmpNo


    Press OK
    Image Modified

  27. Connect the EmployeeNumber output from CSV file to the input inEmpNo of SQL-WHERE condition.
  28. Connect the resulting output of SQL-WHERE to the Employee input element of the XML file.
    Your map should look like the following:
    Wor1C2BImage Modified
  29. Finally, connect the data fields from the database outputs to the corresponding XML file inputs.

    Your final map will look like this:
    Image Modified
  30. Save the map and close MapForce.
  31. On the Details tab, click Prepare to generate the transformation map code.
    Click Prepare on the Prepare Transformation Map dialog.
    Remember to look for an IBM i Signon which may be hidden by other windows.

    Tip
    titleTip
    Use Windows Task Manager to switch to the IBM i Signon dialog.


    Wait for the completion message and Close the Prepare Transformation Map dialog.
    Image Modified