Scenario 1: Viewing product orders status (on a daily basis) against a benchmark number - 6.1

Talend Components Reference Guide

EnrichVersion
6.1
EnrichProdName
Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for Big Data
Talend Open Studio for Data Integration
Talend Open Studio for Data Quality
Talend Open Studio for ESB
Talend Open Studio for MDM
Talend Real-Time Big Data Platform
task
Data Governance
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio

This scenario allows you to insert the orders information into a database table and to evaluate the orders status (every day once scheduled to run) by using tAssert to compare the orders against a fixed number and tAssertCatcher to indicate the results. In this case, Ok is returned if the number of orders is greater than 20 and Failed is returned if the number of orders is less than 20.

In practice, this Job can be scheduled to run every day for the daily orders report and tFixedFlowInput as well as tLogRow are replaced by input and output components in the Database/File families.

Linking the components

  1. Drop tFixedFlowInput, tMysqlOutput, tAssert, tAssertCatcher, and tLogRow onto the workspace.

  2. Rename tFixedFlowInput as orders, tAssert as orders >=20, tAssertCatcher as catch comparison result and tLogRow as ok or failed.

  3. Link tFixedFlowInput to tMysqlOutput using a Row > Main connection.

  4. Link tFixedFlowInput to tAssert using the Trigger > On Subjob OK connection.

  5. Link tAssertCatcher to tLogRow using a Row > Main connection.

Configuring the components

  1. Double-click tFixedFlowInput to open its Basic settings view.

    Select Use Inline Content (delimited file) in the Mode area.

    In the Content field, enter the data to write to the Mysql database, for example:

    AS2152;Washingto Berry Juice;2013-02-19 11:14:15;3.6
    AS2152;Washingto Berry Juice;2013-02-19 12:14:15;3.6
    AS2152;Washingto Berry Juice;2013-02-19 13:14:15;3.6
    AS2152;Washingto Berry Juice;2013-02-19 14:14:15;3.6
    AS2152;Washingto Berry Juice;2013-02-19 12:14:15;3.6
    AS2152;Washingto Berry Juice;2013-02-19 12:14:15;3.6
    AS2152;Washingto Berry Juice;2013-02-19 12:14:15;3.6
    AS2152;Washingto Berry Juice;2013-02-19 12:14:15;3.6
    AS2152;Washingto Berry Juice;2013-02-19 12:14:15;3.6
    AS2152;Washingto Berry Juice;2013-02-19 12:14:15;3.6
    AS2152;Washingto Berry Juice;2013-02-19 12:14:15;3.6
    AS2152;Washingto Berry Juice;2013-02-19 12:14:15;3.6
    AS2152;Washingto Berry Juice;2013-02-19 12:14:15;3.6

    Note that the orders listed are just for illustration of how tAssert functions and the number here is less than 20.

  2. Click the Edit schema button to open the schema editor.

  3. Click the [+] button to add four columns, namely product_id, product_name, date and price, of the String, Date, Float types respectively.

    Click OK to validate the setup and close the editor.

  4. Double-click tMysqlOutput to display the Basic settings view.

  5. In the Host, Port, Database, Username and Password fields, enter the connection details and the authentication credentials.

  6. In the Table field, enter the name of the table, for example order.

  7. In the Action on table list, select the option Drop table if exists and create.

  8. In the Action on data list, select the option Insert.

  9. Double-click tAssert to display the Basic settings view.

  10. In the description field, enter the descriptive information for the purpose of tAssert in this case.

  11. In the expression field, enter the expression allowing you to compare the data to a fixed number:

    ((Integer)globalMap.get("tMysqlOutput_1_NB_LINE_INSERTED"))>=20
  12. Double-click tLogRow to display the Basic settings view.

  13. In the Mode area, select Table (print values in cells of a table) for a better display.

Executing the Job

  1. Press Ctrl + S to save the Job.

  2. Press F6 to run the Job.

    As shown above, the orders status indicates Failed as the number of orders is less than 20.