tSampleRow - 6.1

Talend Components Reference Guide

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
Talend Studio
Data Governance
Data Quality and Preparation
Design and Development

tSampleRow properties

Component family




tSampleRow filters rows according to line numbers.


tSampleRow helps to select rows according to a list of single lines and/or a list of groups of lines.

Basic settings

Schema and Edit Schema

A schema is a row description, it defines the number of fields to be processed and passed on to the next component. The schema is either Built-in or stored remotely 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.

Click Sync columns to retrieve the schema from the previous component in the Job.

This component offers the advantage of the dynamic schema feature. This allows you to retrieve unknown columns from source files or to copy batches of columns from a source without mapping each column individually. For further information about dynamic schemas, see Talend Studio User Guide.

This dynamic schema feature is designed for the purpose of retrieving unknown columns of a table and is recommended to be used for this purpose only; it is not recommended for the use of creating tables.



Built-in: You create the schema and store it locally for the relevant component. 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 flowcharts. Related topic: see Talend Studio User Guide.



Enter a range using the relevant syntax to choose a list of single lines and/or a list of groups of lines.

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.


This component handles flows of data therefore it requires input and output components.


If you are using a subscription-based version of the Studio, the activity of this component can be logged using the log4j feature. For more information on this feature, see Talend Studio User Guide.

For more information on the log4j logging levels, see the Apache documentation at http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html.



Scenario: Filtering rows and groups of rows

This scenario describes a three-component Job. A tRowGenerator is used to create random entries which are directly sent to a tSampleRow where they will be filtered according to a defined range. In this scenario, we suppose the input flow contains names of salespersons along with their respective number of sold products and their years of presence in the enterprise. The result of the filtering operation is displayed on the Run console.

Dropping and linking the components

  1. Drop the following components from the Palette onto the design workspace: tRowGenerator, tSampleRow, and tLogRow.

  2. Connect the three components using Row > Main links.

Configuring the components

  1. In the design workspace, select tRowgenerator, and click the Component tab to define the basic settings for tRowGenerator.

  2. Click the [...] button next to Edit Schema to define the data you want to use as input. In this scenario, the schema is made of five columns.

  3. In the Basic settings view, click RowGenerator Editor to define the data to be generated.

  4. In the RowGenerator Editor, specify the number of rows to be generated in the Number of Rows for RowGenerator field and click OK. The RowGenerator Editor closes.

  5. In the design workspace, select tSampleRow and click the Component tab to define the basic settings for tSampleRow.

  6. In the Basic settings view, set the Schema to Built-In and click Sync columns to retrieve the schema from the tRowGenerator component.

  7. In the Range panel, set the filter to select your rows using the correct syntax as explained. In this scenario, we want to select the first and fifth lines along with the group of lines between 9 and 12.

  8. In the design workspace, select tLogRow and click the Component tab to define its basic settings. For more information about tLogRow, see tLogRow.

Saving and execting the Job

  1. Press Ctrl+S to save your Job.

  2. Press F6, or click Run on the Run tab to execute the Job.

    The filtering result displayed on the console shows the first and fifth rows and the group of rows between 9 and 12.