05-19-2022 02:01 PM
Hi,
I have a set of CSV files that I read from using a CSV Parser. Is there a way the CSV Parser can also output the name of the file. I have already thought of putting the CSVParser in a child pipeline and feed the name of the pipeline as a parameter and reading that out. But I was wondering if there was a better way.
Best,
Rajesh
05-19-2022 06:51 PM
HI @Rajesh,
I tried with Binary router and extracted the file name from content-location. see the attached screenshot -
Does this help?
Regards,
Deepak.
05-20-2022 08:50 AM
Thanks Deepak. I have thought of that approach and then doing a cross join back to the main stream, but that does not seem to work when the input has multiple files.
So if there are 5 files and each file has 5 records, I need to write 25 records to the destination with each source file name identified (a column in the destination table)
10-29-2022 06:18 AM
Hi Rajesh,
Probably too late to answer, you can achieve this by calling a child pipeline with filename and path as pipeline parameters.
Read the file in child, map data, use _filename as another column in mapper.
Get result of all the child pipelines in parent pipeline to combine into single file.