How to count the rows in a rowset variable

If you have a new question you’d like our support staff to post a response to, please visit our customer community, GoAnywhere Insiders, to pose the question in our Discussion Boards. We have a thread “Ask Our Tech Experts” that our support team monitors on a regular basis, or you can start a new discussion where other GoAnywhere users and support staff can weigh in. Log in or create your new account at https://insiders.goanywhere.com.

If you need an immediate response, please create a support ticket or contact our support team by email at [email protected].
2 posts Page 1 of 1

T_Bekker

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_Rick

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
Troy,

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