August 17, 2023

tIterateToFlow – Docs for ESB 5.x

tIterateToFlow

tIterateToFlowOut_icon32_white.png

tIterateToFlow Properties

Component family

Orchestration

 

Function

tIterateToFlow transforms a list
into a data flow that can be processed.

Purpose

Allows you to transform non processable data into a processable
flow.

Basic settings

Schema and Edit
Schema

A schema is a row description, it defines the number of fields
that will be processed and passed on to the next component. The
schema is either Built-in or remote
in the Repository.

Since version 5.6, both the Built-In mode and the Repository mode are
available in any of the Talend solutions.

Click Edit schema to make changes to the schema. If the
current schema is of the Repository type, three options are
available:

  • View schema: choose this option to view the
    schema only.

  • Change to built-in property: choose this option
    to change the schema to Built-in for local
    changes.

  • Update repository connection: choose this option to change
    the schema stored in the repository and decide whether to propagate the changes to
    all the Jobs upon completion. If you just want to propagate the changes to the
    current Job, you can select No upon completion and
    choose this schema metadata again in the [Repository
    Content]
    window.

 

 

Built-in: The schema will be
created and stored locally for this component only. Related topic:
see Talend Studio User Guide.

 

 

Repository: The schema already
exists and is stored in the Repository, hence can be reused in
various projects and Job designs. Related topic: see
Talend Studio User
Guide
.

 

Mapping

Column: Enter a name for the
column to be created

Value: Press Ctrl+Space to access all of the available variables,
be they global or user-defined.

Advanced Settings

tStatCatcher Statistics

Select this check box to collect the log data at a component
level.

Global Variables

ERROR_MESSAGE: the error message generated by the
component when an error occurs. This is an After variable and it returns a string. This
variable functions only if the Die on error check box is
cleared, if the component has this check box.

A Flow variable functions during the execution of a component while an After variable
functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl +
Space
to access the variable list and choose the variable to use from it.

For further information about variables, see Talend Studio
User Guide.

Usage

This component is not startable (green background) and it requires
an output component.

Connections

Outgoing links (from this component to another):

Row: Main.

Trigger: Run if; On Component Ok;
On Component Error.

Incoming links (from one component to this one):

Row: Iterate;

For further information regarding connections, see
Talend Studio User
Guide
.

Scenario: Transforming a list of files as data flow

The following scenario describes a Job that iterates on a list of files, picks up the
filename and current date and transforms this into a flow, that gets displayed on the
console.

Use_Case_tIterateToFlow1.png
  • Drop the following components: tFileList,
    tIterateToFlow and tLogRow from the Palette to the
    design workspace.

  • Connect the tFileList to the tIterateToFlow using an iterate link and connect the Job to the tLogRow using a Row main
    connection.

  • In the tFileList
    Component view, set the directory where the
    list of files is stored.

Use_Case_tIterateToFlow2.png
  • In this example, the files are three simple .txt files held in one directory:
    Countries.

  • No need to care about the case, hence clear the Case
    sensitive
    check box.

  • Leave the Include Subdirectories check box
    unchecked.

  • Then select the tIterateToFlow component et
    click Edit Schema to set the new schema

Use_Case_tIterateToFlow3.png
  • Add two new columns: Filename of String type and Date of date type. Make sure you define the correct pattern
    in Java.

  • Click OK to validate.

  • Notice that the newly created schema shows on the Mapping table.

Use_Case_tIterateToFlow4.png
  • In each cell of the Value field, press
    Ctrl+Space bar to access the list of global
    and user-specific variables.

  • For the Filename column, use the global variable:
    tFileList_1CURRENT_FILEPATH. It retrieves the current filepath
    in order to catch the name of each file, the Job iterates on.

  • For the Date column, use the Talend routine:TalendDate.getCurrentDate() (in
    Java)

  • Then on the tLogRow component view, select
    the Print values in cells of a table check
    box.

  • Save your Job and press F6 to execute
    it.

Use_Case_tIterateToFlow5.png

The filepath displays on the Filename column and the current date
displays on the Date column.


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