Five Stars

Inline fields under herder columns in tfileoutputdelimited ?

Dear community friends,

 

Scenario:

Bulling data from Sales force to tfileoutputdelimited separated by tab and it's .txt 

Problem:

the data is not inline under the columns when I used .txt file, Since there might be empty filed in some column that led to messy fields and not exactly under it's own column header.

 

What I want is that my data looks inline and still separated by \tab , even if there are empty fields. Is that possible in .txt file ?

 

#Please see the attached Pic to see how the field are messexampleMessyfileds.png

1 ACCEPTED SOLUTION

Accepted Solutions
Six Stars

Re: Inline fields under herder columns in tfileoutputdelimited ?

Hi there,

 

Each editor can have different settings for tab spacing, so it's literally not possible to guarantee how tab separated output will look in any particular editor. Even if it looks correct in your text editor, it may not look the same for someone else in their editor.

 

Tabs work by moving to the NEXT tab "stop", and so the size of a tab can be different. In a basic text editor with a monospaced font, if your tab stop/spacing is four characters, and you have nothing on a line, a tab will move you to the 4th character position. If you have typed "AB" at the start of the line, then a tab will still move you to the 4th character position, as this is then next stop, so your tab will effectively be smaller. If you've typed "ABCDE" at the start of the line, then a tab moves to the next tab stop, which is the 8th character. This is why, dependent on the size of the data in each field, the columns don't align as you'd like, and they never will.

 

If you need your columns aligned in this way in an editor using a monospaced font, then you must pad them, usually with spaces, and this can be done by using a tFileOutputPositional component instead of tFileOutputDelimited, but as I'm guessing the output files needs to be read by another system which expects tab separated columns, that may not be useful.

 

It's also worth pointing out that if you are using anything other than a monospaced font (and in most editors you can) then your columns will never align, even if you pad them.

 

Regards,

 

 

Chris

8 REPLIES
Five Stars

Re: Inline fields under herder columns in tfileoutputdelimited ?

Check your Delimiter in the tfileoutputdelimited  and make sure you are using tab. If that still doesn't work, please try to open the text file with some text editor and see if there are any hidden characters. You can use Talend Data prepartion toool too.

Five Stars

Re: Inline fields under herder columns in tfileoutputdelimited ?

I made sure that I use "\t" as field separator. and I select show all charterer this is what happens some Tabs are bigger than others with respect to some empty fields in some columns. (--> means tab)exampleMessyfileds22.png

Six Stars JGM
Six Stars

Re: Inline fields under herder columns in tfileoutputdelimited ?

This is exactly what Talend was built to do. Here's a quick example to show you how it works:

 

1) Here's my example tab delimited data file:

image.png

I made a simple job using tFileInputDelimited and a tLogRow:

image.png

Configure the tFileInputDelimited to use tab as the Field Separator:

image.png

It gives this output:

image.png

Five Stars

Re: Inline fields under herder columns in tfileoutputdelimited ?

That is what I was explaining too

Five Stars

Re: Inline fields under herder columns in tfileoutputdelimited ?

Guys I know what you are explaining I told you I use Tap as field separator , My question is I want the data aligned under each column. My previous picture is clear that the data is not aligned under the .txt file. and the tabs are not the same size ?

 

see the picture I use "\t" as field separator. 

 

exampleMessyfileds3.png

Five Stars

Re: Inline fields under herder columns in tfileoutputdelimited ?

Tab is always a Tab. I see multiple tabs next to each other. So, it is the file issue than Talend job.

Six Stars

Re: Inline fields under herder columns in tfileoutputdelimited ?

Hi there,

 

Each editor can have different settings for tab spacing, so it's literally not possible to guarantee how tab separated output will look in any particular editor. Even if it looks correct in your text editor, it may not look the same for someone else in their editor.

 

Tabs work by moving to the NEXT tab "stop", and so the size of a tab can be different. In a basic text editor with a monospaced font, if your tab stop/spacing is four characters, and you have nothing on a line, a tab will move you to the 4th character position. If you have typed "AB" at the start of the line, then a tab will still move you to the 4th character position, as this is then next stop, so your tab will effectively be smaller. If you've typed "ABCDE" at the start of the line, then a tab moves to the next tab stop, which is the 8th character. This is why, dependent on the size of the data in each field, the columns don't align as you'd like, and they never will.

 

If you need your columns aligned in this way in an editor using a monospaced font, then you must pad them, usually with spaces, and this can be done by using a tFileOutputPositional component instead of tFileOutputDelimited, but as I'm guessing the output files needs to be read by another system which expects tab separated columns, that may not be useful.

 

It's also worth pointing out that if you are using anything other than a monospaced font (and in most editors you can) then your columns will never align, even if you pad them.

 

Regards,

 

 

Chris

Ten Stars

Re: Inline fields under herder columns in tfileoutputdelimited ?

You can't guarantee that the output will look good on screen with a delimited file. You're looking for a positional file, which can be created with tFileOutputPositional.