Uploading CSV files into database

0 votes

I have various input files with fixed number of rows which always begin with the following 7 lines of information:

"Factuur","12345678" 

"Datum","27/02/2012" 

"Totaal:","1" 

"Totaal netto:","99,18" 

"Totaal bruto:","107,13" 

"Verzamel factuurnummer:","1234567890A" 

"Valuta:","EUR" 

"TXN tijd (dd/mm/jj)","TXN Nr","Kostenplaats naam","Truncated... "11/02/2012 02:22";"00000222";"";"722222";"Truncated... "12/02/2012 02:22";"00000223";"";"722222";"Truncated... "13/02/2012 02:22";"00000224";"";"722222";"Truncated…

Note: There are two different delimiters used comma(,) and semi-colon(;).

I want to import the above data into a SQL database table. I know the process of importing data from the source file into a database but my problem is how do I append the new information in the header rows of every relevant table?

The final output should look like below:

Factuur        Datum      …    TXT tijd            TXN Nr. …    

12345678    27-2-2012     …    11-2-2012 02:22     00000222

12345678    27-2-2012     …    12-2-2012 02:22     00000223

Please suggest how can I perform this.

Apr 16, 2018 in Talend by misc.edu04
• 1,380 points
32 views

1 answer to this question.

0 votes

In order add the header data into all the files, store them as global variables.

Try following the below steps:

  1. Add tFileInputDelimited(x2), tJavaRow, tMap and tLogRow components in the workspace and connect them as shown below:

enter image description here

  • In the tfileInputDelimited_1 component set the schema(key,value), separator (",") and limit 7.

  • In the tJavaRow component write : globalMap.put(input_row.key, input_row.value);

  • In the tFileInputDelimited_3 component set the schema (TXN_tijd, TXN_Nr, Kostenplaats_naam, … ), separator (";") and header 8

  • Double click on tMap component to open the tMap editor. Then map the input tables with the output as shown below:

enter image description here

Hope this works for you.

answered Apr 16, 2018 by geek.erkami
• 2,320 points

Related Questions In Talend

0 votes
1 answer

How to load a set of files into database using Talend

Using tFileList component,  you can read all the files present ...READ MORE

answered Apr 16, 2018 in Talend by code.reaper12
• 3,450 points
442 views
0 votes
1 answer
0 votes
2 answers
0 votes
1 answer

Converting Columns into Rows in Talend

Hi, You can try using tNormalize component along ...READ MORE

answered Apr 10, 2018 in Talend by code.reaper12
• 3,450 points

edited Apr 10, 2018 by code.reaper12 538 views
0 votes
1 answer

Looping through all the schemas in Talend

It is really simple to make tOracleInput ...READ MORE

answered Apr 10, 2018 in Talend by code.reaper12
• 3,450 points
62 views
0 votes
1 answer

Adding third party libraries into the Talend project

You can add the 3rd party libraries ...READ MORE

answered Apr 9, 2018 in Talend by code.reaper12
• 3,450 points
257 views
0 votes
1 answer

tWaitForFile component insufficiency in Talend

Regarding your first issue, tWaitForFile component provides ...READ MORE

answered Apr 10, 2018 in Talend by geek.erkami
• 2,320 points
229 views
0 votes
1 answer

Downloading files using Talend Studio

As per my understanding, I think first ...READ MORE

answered Apr 11, 2018 in Talend by code.reaper12
• 3,450 points
187 views
0 votes
1 answer

Assigning Context Variable from the database value

I think if you want to link ...READ MORE

answered Apr 19, 2018 in Talend by geek.erkami
• 2,320 points
120 views
0 votes
1 answer

Comparing 2 files and keeping the unique entries

Hi, To get the unique records from the ...READ MORE

answered Apr 20, 2018 in Talend by geek.erkami
• 2,320 points
62 views