Split Rows to Columns

Split Rows to Columns
5 (100%) 4 votes

This post I will describe you how to split rows into columns, we will use below sample as input records.

Input Rows.

Input Rows
Input Rows

Expected Output.

out put
Out Put

Create a Job and add tFixedFlowInput component and  put above input as “Use inline content” and create schema as shown in image.

Input Schema
Input Schema

Add tPivotToColumnsDelimited  component and connect with tFixedFlowInput component as main connection then configured this component shown in below image.

tPivot component Configuration
tPivot component Configuration

Configurations :

Pivot Column =”Type”

Aggregation column=”Value”

Aggregation Function =”last”

Group by “ID” and “Name” column.

Rest of the configuration is for output file, where our output will be transferred. to read output file we can use either delimited component but for quick review I`ll use tFileInputFullRow.

Add tFileInputFullRow below the tFixedFlowInput component and connect with “On Sub Job Ok” trigger. and provide previously created file path and rest of the details.

add tLogRow and connect to tFileInputFullRow component and execute the job you will get above out put on console.

Final Job Design.

Job with OutPut
Job with OutPut

This component will create N number of columns based on your input, if you are dealing with fix schema then it will create complexity for further processing.

 

About Umesh

I am Software consultant with approx 7 years of experience mainly in Business Intelligence and data warehousing assignments using Talend. Writing is not my passion but i am doing it to help others. if you have any special case where you want me to demonstrate then please post me.

Leave a Reply

Your email address will not be published. Required fields are marked *