#1 2009-05-28 15:32:38

guenniac
Member
Registered: 2009-03-11
Posts: 48

write 2 header lines

Hi,

in my tFileOutputDelimited I need for some reason 2 header lines before the data, one empty line and the header line itself.
e.g.
<empty line>
ColA;ColB;ColC
1;2;3
4;5;6


How can I achieve this goal?

Thanks
Guenter

Offline

#2 2009-05-28 15:39:15

cahsohtoa
Member
Company: AEFE
Registered: 2008-02-19
Posts: 261
Website

Re: write 2 header lines

you can set header to 2 in the advanced settings

Offline

#3 2009-05-28 15:47:21

kzone
Member
Company: Synotis
Registered: 2008-07-06
Posts: 909
Website

Re: write 2 header lines

hi,

I can also do it in a metadata , with check heading and header =>  2.

++


Uploaded Images

Last edited by kzone (2009-05-28 15:50:15)


do Svg your graphical language !!!

Offline

#4 2009-05-28 15:53:07

guenniac
Member
Registered: 2009-03-11
Posts: 48

Re: write 2 header lines

I use TOS 3.1.1.
Advanced options are:
- Erweitertes Trennzeichen(für Zahlen) (delimeter for numbers)
- CSV options
- Bei Bedarf Verzeichnis erstellen (create directory if necessary)
- Split output in several files
- custom the flush buffer size
- output in row mode
- Encoding type

No way to set the nr of header lines in output

Offline

#5 2009-05-28 16:02:58

kzone
Member
Company: Synotis
Registered: 2008-07-06
Posts: 909
Website

Re: write 2 header lines

oups ... didn't seen it was an OUTput file !

What the structure of the input * ?
I 've tried with a tunite to add empty lines and header (uncheck skip empty row) but still have ';' in the first line

hum hum !

Last edited by kzone (2009-05-28 16:17:07)


do Svg your graphical language !!!

Offline

#6 2009-05-28 16:53:55

kzone
Member
Company: Synotis
Registered: 2008-07-06
Posts: 909
Website

Re: write 2 header lines

ok,

it depends on your inputflow but you can create a empty file and append your data to it ... it will create the empty line that you need.

Ps : seems bad solution !! (with tfiletouch doesn't work and you have to create "by hand") ... so forget ...sorry !
++

Last edited by kzone (2009-05-28 17:03:24)


do Svg your graphical language !!!

Offline

#7 2009-05-29 05:33:35

c0utta
Member
Registered: 2007-04-13
Posts: 134

Re: write 2 header lines

Hi guenniac,

Or insert a newline character at the beginning of the header:

http://www.talendforge.org/forum/viewtopic.php?id=6440

Cheers,

c0utta

Offline

#8 2009-06-02 10:49:56

guenniac
Member
Registered: 2009-03-11
Posts: 48

Re: write 2 header lines

Hi,

thanks for the advice.
Since I have to deal with thousands of files with big content I think counting the lines could be a performance drawback.

The idea of prepending the first element of the header line with a '\n' looks good but I don't know how to do this (I'm TOS beginner).

My idea is: when starting a new output file I copy a template containing just a line break to the output file and append the  content of the input file(s).

Any further hints?

Regards

Offline

#9 2009-06-04 07:43:42

c0utta
Member
Registered: 2007-04-13
Posts: 134

Re: write 2 header lines

Hi guenniac,

No problems - we've all been beginners.  You didn't specify Perl or Java so I'll use Java, but you'll get the idea.

Basically you need to detect the first line of the flow - there are many ways to accomplish this, but the easiest is to use a tJavaFlex (or tPerlFlex).

Start Code

Code:

boolean first = true;

Main code

Code:

row2.ID = row1.ID + ( first ? "\n2nd header line" : "" );
first = false;

Results

Code:

JbWmTY
2nd header line
sKuqw8
PeOpQR
p2Yx7W
uVDIg4

I've used the RowGenerator to generate my data.

Cheers,

c0utta

Last edited by c0utta (2009-06-04 07:44:05)

Offline

Board footer

Powered by FluxBB