Five Stars

Extract data after detecting particular information in a CSV file

Hello, I have a csv file (~ 40000 lines), at the beginning and at the end of the file I have technical information. I would like to retrieve particular information by detecting data :
"END OF REPORT","Selection Criteria"
,,,,,,,,,
,"Period:","05/2018",
I would like to extract the Period data after the END OF REPORT : "05/2018".

How can I do that ?

EDIT : Maybe I have to use Regex ?

Thanks
1 ACCEPTED SOLUTION

Accepted Solutions
Ten Stars

Re: Extract data after detecting particular information in a CSV file

after reading data ad tmap with 1 boolean var named endOfCsvFile
first detect "END OF REPORT" to set it as true.
var.endOfCsvFile || row1.col1.equals("END OF REPORT")

filter the output of the tmap (stop sending data when endOfCsvFile is true)

add a new output to outPeriald add filter on this output
to retive row1.col3 only when row1.col2.equals("Periode")

Francois Denis

Don't forget to tag when it's "solved"!

2 REPLIES
Ten Stars

Re: Extract data after detecting particular information in a CSV file

after reading data ad tmap with 1 boolean var named endOfCsvFile
first detect "END OF REPORT" to set it as true.
var.endOfCsvFile || row1.col1.equals("END OF REPORT")

filter the output of the tmap (stop sending data when endOfCsvFile is true)

add a new output to outPeriald add filter on this output
to retive row1.col3 only when row1.col2.equals("Periode")

Francois Denis

Don't forget to tag when it's "solved"!

Five Stars

Re: Extract data after detecting particular information in a CSV file

Thanks for your reply. It works fine.