DEV Community

James Moberg
James Moberg

Posted on

Identify if ColdFusion Query Row is "empty"

I'm using the Handsontable javascript gid component. It provides my web applications the ability to copy/paste columnar data, review and edit before importing. During the online "save" process, the SheetClip plugin stringifies the data and it's posted it to the ColdFusion application server where it's converted it into a query-of-queries (using a CSV-to-Query UDF that I have) and then the individual rows are inserted into the database.

I've also encountered strange issues where multiple empty rows are retained after reading an Excel file via cfspreadsheet.

I was trying to determine the easiest way to identify whether the query row was empty so I wouldn't have to perform any inline if/then/else logic on all of the columns. I didn't find any pre-existing UDF at CFLib.org, so I sat down and wrote this.

Live Demo via TryCF.com

https://www.trycf.com/gist/796c63867cb426b5f5fad791cdcfa4b2

Source Code

Top comments (0)