Skip to end of metadata
Go to start of metadata

Introduction

Module 2 in the Introduction to the Jitterbit Harmony Cloud Studio training course demonstrates querying data from multiple tables in a Postgres database and writing it to an SFTP server in a hierarchical XML format.

Prerequisites

This page assumes you have completed Module 1 - Database to Text, where you configured connections to Jitterbit's training Postgres database and SFTP server.

Summary

In this module, you will use the Postgres database to connect to the OrderDetail and OrderHeader tables. Once connected, you'll merge that data and write it in a hierarchical format to the training SFTP server.

The completed operation will look like this:

This operation uses this transformation mapping:

1. Configure a Database Activity

For this module, you continue working within the same project and reuse the same Postgres database connection as in Module 1, but configure a separate query activity to retrieve different data from the database:

  1. Within the same project as Module 1, create a new workflow and name it "Module 2."
  2. From the component palette's Connectivity tab under the Endpoints filter, click the "Postgres Database" connection you created in Module 1 to show associated activities below it:

  3. Drag a database query activity to the new component block within the workflow to create a new operation.
  4. Rename the operation to "DB to XML."
  5. Double-click the query activity within the operation to open its configuration.
  6. Configure the database query activity:
    • Name: "Query Order Header & Order Detail Tables"
    • Select Table(s): Refresh the tables and select the OrderDetail and OrderHeader tables. Then within the OrderDetail row:
      • Parent: Use the dropdown to select OrderHeader.
      • Link Keys: Click Assign. In the popup, drag OrderID in the parent table to OrderID in the child table. Click Finished.
      • Join Type: This field becomes available after assigning link keys. Use the dropdown to select Zero or More. Click Next.
    • Source: PostgreSQL: Select the checkbox next to OrderHeader to include all fields in the query.
    • Data Schema: Review the data schema and click Finished to return to the design canvas.

The final screen of activity configuration should look similar to this:

2. Configure an FTP Activity

In addition to reusing the database connection, you can also reuse the FTP connection from Module 1. In this step, you use the same connection to the SFTP training server, but configure a separate write activity:

  1. From the component palette's Connectivity tab under the Endpoints filter, click the "SFTP" connection you created in Module 1 to show associated activities below it:

  2. Drag an FTP write activity to the right of the database query activity within the operation on the design canvas.
  3. Double-click the FTP write activity within the operation to open its configuration.
  4. Configure the FTP write activity:
    • Name: "XML SFTP"
    • Path: "/" (forward slash)
    • Filename(s): "result_[date]_[time].xml". Click Next.
    • Data Schema: Since you didn't provide a schema, there is nothing to review in the second screen. Click Finished.

3. Configure a Transformation

Next, you create a transformation to transform data from the database source to the FTP target:

  1. On the design canvas, hover over the area between the database query activity and the FTP write activity until a new component block appears.
  2. Click the block and select New Transformation. A new transformation will open for you to configure:
    • Transformation Name: "DB to XML"
    • Source: The source schema is already provided (on the left).
    • Target: You need to define the target schema (on the right). Click Mirror Source Schema to replicate the database structure in XML.
  3. Drag the OrderHeader source node to the row target node and select Automap.

    TIP: The solid black lines that are displayed between the source and target nodes are called iterator lines. These lines indicate that the mapping supports multiple records (instances).
  4. Along the top of the transformation header, click the gray Preview button to begin the preview process for testing and validating the mappings. Click Next to deploy the components listed and then click Finished.

  5. The preview screen displays data populated from the source and mapped to the target. Click the right and left arrows to cycle through the imported data.

  6. After reviewing the data, click Return to Workflow. Clicking this button saves the work you did in the transformation.

The transformation preview should look similar to this:

4. Deploy and Run the Operation

Finally, with all operation steps configured, you deploy and run the operation:

  1. In the top right of the operation, click the actions menu icon  and from the menu click Deploy and Run. The operation status is displayed in the lower left of the operation.
  2. Once the operation is successful, log in to Jitterbit's training SFTP server and view the file you generated.
On This Page

Last updated:  Jan 29, 2020

  • No labels