August 15, 2023

Scenario 2: Sorting entries based on dynamic schema – Docs for ESB 6.x

Scenario 2: Sorting entries based on dynamic schema

This scenario applies only to a subscription-based Talend solution.

In this scenario we will sort entries in an input file based on a dynamic schema,
display the sorting result on the Run console, and save
the sorting result in an output file. For more information about the dynamic schema
feature, see
Talend Studio User
Guide
.

Use_Case_tSortRow5.png
  • Drop the components required for this use case: tFileInputDelimited, tSortRow,
    tLogRow and tFileOutputDelimited from the Palette to the design workspace.

  • Connect these components together using Row
    > Main links.

  • Double-click the tFileInputDelimited
    component to display its Basic settings view.

Use_Case_tSortRow6.png
Warning:

The dynamic schema feature is only supported in Built-In mode and requires the input file to have a
header row.

  • Select Built-In from the Property Type list.

  • Click the […] button next to the File Name field to browse to your input file. In this
    use case, the input file cars.csv has five columns:
    ID_Owner, Registration,
    Make, Color, and
    ID_Reseller.

  • Specify the header row in Header field. In
    this use case the first row is the header row.

  • Select Built-In from the Schema list, and click Edit
    schema
    to set the input schema.

Use_Case_tSortRow7.png
Warning:

The dynamic column must be defined in the last row of the
schema.

  • In the schema editor, add two columns and name them
    ID_Owner and Other respectively.
    Set the data type of the Other column to Dynamic to retrieve all the columns undefined in the
    schema.

  • Click OK to propagate the schema and close
    the schema editor.

  • Double-click tSortRow to display the
    Basic settings view.

Use_Case_tSortRow8.png
  • Add a row in the Criteria table by clicking
    the plus button, select Other under Schema column, select alpha as the sorting
    type, and select the ascending or
    descending order for data output.

Warning:

Dynamic column sorting works only when the sorting type is
set to alpha.

  • To view the output in the form of a table on the Run console, double-click the tLogRow component and select the Table option in the Basic
    settings
    view.

  • Double-click the tFileOutputDelimited
    component to display its Basic Settings
    view.

Use_Case_tSortRow9.png
  • Click the […] button next to the File Name field to browse to the directory where you
    want to save the output file, and then enter a name for the file.

  • Select the Include Header check box to
    retrieve the column names as well as the sorted data.

  • Save your Job and press F6 to run it.

    The sorting result is displayed on the Run
    console and written into the output file.

Use_Case_tSortRow11.png


Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x