Six Stars

Stop reading CSV file at empty row

Hello,

I'm a Talend and Java newbie. I need your help for the following problem.

 

I have to read a CSV file, that has 2 parts:

part1

part1

part1

            <---- empty row

part2

part2

part2

 

Part2 will grow extremly and I need only part1. Can this be solved in Talend or is it better to use Powershell to prepare the data before?

 

Sorry, but my English is very poor.

 

Thanks

 

  • Data Integration
Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
Eleven Stars TRF
Eleven Stars

Re: Stop reading CSV file at empty row

Hi,

You can easily ignore the records after an empty has been detected, but you can't stop the reading process.

To do that, set a global variable (lets say "Continue" for example) to True as soon an empty record is detected (using tJavaRow) and in a tMap, add a filter expression to the output flow to ignore the record if the global is True:

(Boolean)globalMap.get("Continue")

Hope this helps.


TRF
2 REPLIES
Eleven Stars TRF
Eleven Stars

Re: Stop reading CSV file at empty row

Hi,

You can easily ignore the records after an empty has been detected, but you can't stop the reading process.

To do that, set a global variable (lets say "Continue" for example) to True as soon an empty record is detected (using tJavaRow) and in a tMap, add a filter expression to the output flow to ignore the record if the global is True:

(Boolean)globalMap.get("Continue")

Hope this helps.


TRF
Six Stars

Re: Stop reading CSV file at empty row

Thanks,

will use awk, the file can be very very very large.

regs