Wednesday, April 22, 2015

How to use tFixedFlowInput component in Talend

In this post I will show you how to use tFixedFlowInput Component.
tFixedFlowInput Component is used to generate fixed record.

Firstly drag tFixedFlowInput component from palette and drop it to the design workspace.Open the component properties of  tFixedFlowInput by double click on component.
This window will appear here Number of rows specify the number of records you want to generate we want four records so we write 4 there.



Click on Edit Schema Button and define the columns.For example we want three columns Employee_Id,First_Name,Last_Name.So click on "+"and add these columns and define there type and length.

Now once the column are added we want to generate four records like this:
Employee_Id;First_Name;Last_Name
1;Samuel;Lasson
2;Lee;Ortega
3;John;Cohen
4;Umar;Park

These component provide three options to do this:
1.Use Single Table
2.Use Inline Table
3.Use Inline Content(delimited file)

First we will see Use Single Table Option how it works
Click on Use Single Table Option and write the values of column.In the same way write for all Employee .
We use 'Use Single Line' option when we want to insert only one row at a time where you can mention the column names and respective values for the columns.


Then select Use Inline Table click on "+" button add 4 rows and write the values.
We use 'Use Inline Table' option when we want insert more than one row at a time where you can mention the column names and respective values for the columns.


Atlast select Use Inline Content(delimited file) Option and write all the records you want to generate.
We use 'Use Inline Content' option where we can paste the data with proper delimiter with more than one row.


Then drag tLogRow component from palette to design workspace and connect tFixedFlowInput component to tLogRow by selecting Row > Main.


Here Run the job.
You can select any option such as Use Single Table,Use Inline Table and Use Inline Content you will get the same result.


Four rows are executed successfully and you have generated fixed records.

Tuesday, April 21, 2015

How to combine multiple records to single records using tDenormalize ?

In this post will see how to combine multiple records separated by comma to a single column, below I have used a basic example which will help you to understand the logic behind the component. After this post you should be able to apply the same logic in your jobs.

tDenormalize: This component is reverse of tNormalize. In tNormalize it split records to multiple records .Here in tDenormalize it combine multiple records to single records.

This is output of tnormalize as shown in previous post .Here this is used as Input file.

Supplier_ID;Supplier_Name;Supplier_Products
101;Nick Pvt Ltd;Desktop
101;Nick Pvt Ltd;Laptop
101;Nick Pvt Ltd;Mobiles
102;Shiny Shipping;WiFi Routers
102;Shiny Shipping;PC
102;Shiny Shipping;Networking Wires
103;Michael Pvt Ltd;RAM
103;Michael Pvt Ltd;Hard-Disk
103;Michael Pvt Ltd;Servers
104;Rose Marry Ship Pvt Ltd;Pen Drive
104;Rose Marry Ship Pvt Ltd;DDR Memory
104;Rose Marry Ship Pvt Ltd;Tablet
105;Mark Pvt Ltd;Watch
105;Mark Pvt Ltd;Refrigerator
105;Mark Pvt Ltd;CD

1. Create metadata as shown in previous post (tNormalize example) Metadata > File Delimited > Denormalize.Then drag it to the design workspace and select tFileInputDelimited component from the Popup. 
2. Drag following components from palette: tDenormalize,tlogrow.
tdenormalize component is used to combine values from multiple records.We have taken Supplier_Products column to denormalize.
tlogrow is used to display the output.
3.Connect the components using Row > Main connections.

Open the component properties of the tDenormalize component click on Sync columns to propogate the metadata then select Supplier_Products option from dropdown list in to denormalize section.Write "," as delimiter and tick checkbox of Merge same value.



Open the component properties of tLogRow and select in Basic Settings Table (print values in cell of a table) to show result in table format.

Then Run the job.
You can see that 15 rows are denormalized into 5 rows.


We have taken 15 rows in our input and it is resulted in 5 rows as a output .
15 multiple records are combined into 5 single records.This is Denormalization.