ColdFusioning: Pronunciation \kold-fy�-zhn-ing\ Noun: The action of one that writes ColdFusion.

QueryDeleteRows UDF in CFLib

Oddly enough, ColdFusion doesn't have a QueryDeleteRows function. Luckily for us, Ray Camden has come up with a UDF to help us. If you view the UDF in CFLib you can plug that UDF into your code and then just issue a


<cfset x = "1" />
<cfset Query = QueryDeleteRows(Query,x) />

and it will remove your row. You can even list multiple rows (e.g. "1,3,5"). This function is especially helpful with Fusebox because I had pre-existing to create a drop-down menu and I didn't need a row.

Thanks Ray!



Comments
Dominic O'Connor's Gravatar You can also use the underlying Java to remove query rows and it will save you from looping through the query.

Query.removeRows(JavaCast("int",startRow-1),JavaCast( "int", Rows ));

You have to subtract 1 from the ColdFusion Query row index, because the Java row numbering starts at 0.
# Posted By Dominic O'Connor | 4/6/09 11:55 AM