November 6, 2019 at 11:40 am
Hi, I have 3 flat file sources. Now I want to count the number of records in each flat file and I want to write the counts to a flat file in the below output.
FileName Count
can anyone suggest me step by step on how exactly I achieve this ?
Many Thanks
November 6, 2019 at 1:34 pm
You want only the counts, not the data in the files?
Use a Script Task to get the counts
var rowCount = File.ReadLines(file).Count();
and write that out to a file of your choice ... all done using a Script Task.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
November 6, 2019 at 1:36 pm
yes ONLY the counts and not the data but the csv output file should contain the below fields.
FileName Count
Thank you
November 6, 2019 at 1:37 pm
Phil, can you please give me the exact code the for the script task ?
November 6, 2019 at 1:44 pm
Phil, can you please give me the exact code the for the script task ?
I could, but that would mean I was doing your job for you.
How about you at least attempt this & come back with any questions you encounter along the way?
Otherwise, I will provide you with a quotation for my services on a consultancy basis.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
November 7, 2019 at 11:09 am
Hi Phil, do you think its better to use Row count transformation and take the counts into variables first ?
Thanks
November 7, 2019 at 12:21 pm
Hi Phil, do you think its better to use Row count transformation and take the counts into variables first ?
Thanks
Getting row counts using that transformation requires reading every row of every file. It will work, but it will be slower that using the scripted solution I suggested.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply