Sharing Knlowledge With The World…

Month: May 2013

Custom Header Footer In Talend

Capture
Hi Readers,
                 Today we will discuss how to add custom header and footer using Talend Open Studio.

Scenario:- Adding custom header and footer using Talend where in Header includes spaces which   are generally not allowed and as well as footer contains no of records to be written on to the file.
below snapshot shows the overall progress

tFileInputDelimited1_1 is used to take input source file, just select limit=1 while fetching records and in, tJavaFlex_1 write your own header which you want to populate on the destination file in the main body code section.
let’s say in my case i have used

row3.first=”First Name”;
row3.last=”Last Name”;

Please be sure that in your tFileOutPutExcel_1 you have to uncheck include header option. This completes your first job.

now,

 In your second job use your input source file and process the data as per your requirements and further after processing put all your data to the same output file as defined earlier kindly uncheck include header option and check append existing file and append existing sheet option.
last,

In your third job while fetching data use limit = 1 for records and only select one column in your schema definition and further  in tJavaFlex component use the following code to print the number of rows at the header.

row5.first=((Integer)globalMap.get(“tFileInputDelimited_3_NB_LINE”)).toString()+” “+”rows”;


for last two output_files


*file names in all the three jobs must be same with different select options.

Thank you for reading…

Talend Interview Questions

Author : Ankit Kansal & Nayan Naik
Continue Reading

Talend – Merge multiple files into single file

overall
Hi Readers,
                  Today we will discuss how to merge multiple files in Talend Open Studio with sorting operation on all.

Scenario: Merging multiple input sources into a single target along with the file names with a additional column and sorting operations on all files with in the flow

The snapshot below shows the overall mapping.


As a source we have taken tFileList which will pull all our source files from the specified directory, then tFileInput Component will read all files one by one. In source file path you have to specify the global variable which holds the address of the current file in process using–

((String)globalMap.get(“tFileList_1_CURRENT_FILEPATH”))

Later tMap is used to assign one extra column which holds the name of the file and again name of the file is to be retrieve using global variable in our case it is

((String)globalMap.get(“tFileList_1_CURRENT_FILE”))

After completion of first job we fire a onSubJobOk trigger to do our rest work.

now,

        tBufferInput will hold all the source file data at once and later tBufferInput will pull all the buffered data produced by tBufferOutput.
Finally, tSort Component will sort all the three source file data using some column as a key and tFileout- component will produce the final output.

that’s all, now you can create a job and simply run it—>>>

Thanks for reading……

Talend Interview Questions

Author : Ankit Kansal & Nayan Naik

Continue Reading

Loading Fact Table Using Talend

Capture4
Hi Readers,
                   In this post we will discuss how to load a fact table in a data warehouse using your dimension table and the data staged in a staging table. We will just show you what is the procedure of loading and further complexities depends upon your business requirements.
In our example we took THREE dimension tables.
  1. DIM_BOOK
  2. DIM_CUSTOMER
  3. DIM_TIME

All of the dimension tables are SCD-type implemented other than TIME DIMENSION.

STEPS:—->>>
1) create an connection first as i am using oracle as a database that’s why i used tOracleConnection.
2) After Successful connection run the further part.
From Dimension tables you have to fetch the data using Query Editor and place a condition where
END_DATE is null, if you have implemented SCD type-2 This will bring all those recordswho have currently validated state.
Now Fetch the OLTP data stored currently in Staging Table, and put all connections in tMap.
REMEMBER—-your staging table that has to be loaded must be first linked then only it will work fine and all other dimensions connected will work as a LOOKUP.



Now in tMap join all the dimensions with your source data using the keys and fetch down the SURROGATE_KEY and put all those skeys in the fact table. In my join condition i have used inner join as a join method.
In tmap component i have use some calculations to find out what are the percentage in discount and total value for the order . It may be anything depend upon your requirements.

note:- Just keep in mind data type conversion you have to keep in mind other wise it’ll give you trouble a lot in my case i just converted my data types in staging itself.

Thank you for taking interest….

Talend Interview Questions

Author : Ankit Kansal & Nayan Naik
Continue Reading
PageLines