Skip to content

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.
If you need a quicker response, please create a support ticket via the customer portal my.goanywhere.com or contact our support team by email at [email protected].
  • T_Bekker Offline
  • Posts: 8
  • Joined: Fri Aug 10, 2012 11:55 am

How to count the rows in a rowset variable

Post by T_Bekker »

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 Offline
  • Support Specialist
  • Posts: 590
  • Joined: Tue Jul 17, 2012 2:12 pm
  • Location: Phoenix, AZ
  • Contact:

Re: How to count the rows in a rowset variable

Post by Support_Rick »

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
Post Reply