queryCurrentRow

Returns the current row number

queryCurrentRow(query) → returns numeric

Member Function Syntax

query.currentRow()

This function requires Lucee.  Not supported on Adobe ColdFusion, etc.

Argument Reference

query query
Required

Examples
Sample code invoking the queryCurrentRow function

Here we've example to get the currentRow number.

<cfset myQuery = queryNew("id,name","integer,varchar",[[1,"Rajesh"],[2,"Anil"]])>
<cfloop query="myQuery">
	<cfif name Eq "Anil">
		<cfoutput>#queryCurrentRow(myQuery)#</cfoutput>
	</cfif>
</cfloop>

Expected Result: 2

Here we've example to get the currentRow number from query using script syntax.

<cfscript>
var myQuery = queryNew("id,title","integer,varchar",[[1,"Charlottes Web"],[3,"The Outsiders"],[4,"Mieko and the Fifth Treasure"]]);
cfloop(query = "myQuery"){
	if (title Eq "Mieko and the Fifth Treasure"){
		writeOutput(myQuery.currentRow());
	}
}
</cfscript>

Expected Result: 3


Fork me on GitHub