Returns the current row number
queryCurrentRow(query)
→ returns numeric
query.currentRow()
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
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.