Pages

Friday, August 23, 2013

Talend XML - Grouping Elements

Talend XML Grouping

Trainer e-Mail: manask1703@gmail.com                                                                        Ph:+91 8099074539
   

Converting CSV file to XML file with grouping of elements for example i have records in CSV 
file like following.

CSV File Content:

                                     CONTINENT,COUNTRY

                                     Asia,India

                                     Asia,Pakistan

                                     Asia,Bangladesh

                                     Asia,Nepal

                                     Asia,Srilanka
                                     Africa,Ethiopia
                                     Africa,Kenya
                                     Africa,Egypt
                                     Africa,Algeria
                                    Africa,Uganda
                                    Africa,Tanzania
Out XML Should be:


                            <?xml version="1.0" encoding="ISO-8859-15"?>

                                <root>

                                   <CONTINENT CONTINENT="Asia">

                                               <row/root COUNTRY="India"/>

                                               <row/root COUNTRY="Pakistan"/>

                                               <row/root COUNTRY="Bangladesh"/>
                                               <row/root COUNTRY="Nepal"/>                                               <row/root COUNTRY="Srilanka"/>                                  </CONTINENT>                                 <CONTINENT CONTINENT="Africa">                                               <row/root COUNTRY="Ethiopia"/>                                               <row/root COUNTRY="Kenya"/>                                               <row/root COUNTRY="Egypt"/>                                               <row/root COUNTRY="Algeria"/>                                               <row/root COUNTRY="Uganda"/>                                               <row/root COUNTRY="Tanzania"/>                                 </CONTINENT>
                            </root>


Job Process:

Step 1: Create tFileInpuDelimited to read the data from CSV file
Step 2: Take tFileOutputXML map Input and Output using with tMap
Step 3: In tFileOutputXML Change Advance Setting Add the Group By Image given below









Thursday, August 22, 2013

Talend - Merge Files

Trainer e-Mail: manask1703@gmail.com                                                                        Ph:+91 8099074539

Scenario 1:
  • One file has 50 rows and another file has 30 rows
  • If you want to combine both and need to get output as 80 rows
Solution:
  • Read the both files with tFileInputFullRow
  • Combine the files with tUnite component
Please find the screenshot below



Scenario 2:
  • One Template File is there 
  • Daily I am getting files and I expected format of Template file
  • If format is same then I want process those.
Solution
  • Read the both files with tFileInputDelimited
  • Join (Left outer Join) the both files using with tJoin / tMap 
  • Note: TemplateFile should be connect with Lookup  and capture the output from Main Section 
Please find the screenshot below