How to count the rows in a rowset variable

Post any question you may have in regards to GoAnywhere MFT and let our talented support staff and other users assist you.
2 posts Page 1 of 1


Posts: 8
Joined: Fri Aug 10, 2012 11:55 am

Post by T_Bekker » Mon Mar 21, 2016 4:59 pm
We retrieve a file via SFTP, then read it with the Read CSV task. There is no output variable for the number of records read. Is there a way to determine the number of records in the rowset before proceeding? Currently when the file is empty (no rows), the read CSV task completes successfully, but the next step to insert the records into a database fails.


Support Specialist
Posts: 592
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Thu Apr 14, 2016 4:20 pm

The quick answer is, there is no "reccount" var attached to the read CSV.

This is one quick way to check.

Do a "Search and Replace" in the file of the CRLF (or LF--depending on End of record marker). Replace it with the same thing.

For example:

<searchAndReplace inputFile="MyInboundFile.csv" outputDir="${system.job.workspace}" searchFor="${system.carriageReturn}${system.lineFeed}" replaceWith="${system.carriageReturn}${system.lineFeed}" numReplacementsVariable="NoRecs" version="1.0" />

When finished, you should have a variable called "NoRecs" that contains the number of Records (End of Record Markers) that was changed... which should give you the record count.

Hope this helps!
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
2 posts Page 1 of 1