Page 1 of 1

File count to report writing

Posted: Wed Jan 02, 2019 1:53 pm
by cwhiteley
Hello All,

I'm trying to get a count of the number of records within the csv files being placed into the input for my switch flow then output this count into an excel report.

Multiple different files can be placed into the flow throughout the day and ideally I would get a final count of each file into one report at the end of the day and have that sent out.

Could someone help point me in the right direction on how to do this?

Many Thanks

Re: File count to report writing

Posted: Wed Jan 02, 2019 2:53 pm
by jan_suhr
In the File class you have a function readLines()

Search in the Scripting manual for "lines"

Re: File count to report writing

Posted: Wed Jan 02, 2019 3:03 pm
by r.zegwaard
First you should write a scripts which processes the incomming files. It should open the csv-file and read the number of lines in it.
Then append this number and the job-name in another csv-file. Both number and the job-name should be on the same line and separated by a comma, tab or semi-colon.

Then add an "inject job" to your flow and configure it to inject the created csv-file at a "time of day"

Robert

Re: File count to report writing

Posted: Wed Jan 02, 2019 3:05 pm
by gabrielp
This script/app counts on line breaks using the method Jan mentioned above:
- https://github.com/open-automation/switch-count-rows
- https://www.enfocus.com/en/appstore/product/count-rows

Re: File count to report writing

Posted: Wed Jan 02, 2019 3:16 pm
by cwhiteley
Thanks all :)