queryGetCell

Returns data contained in that specific cell

queryGetCell(query, column_name [, row_number]) → returns any

Member Function Syntax

query.getCell(column_name [, row_number])

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

Argument Reference

query query
Required

column_name string
Required

row_number numeric
Default: -9999

Examples
Sample code invoking the queryGetCell function

Here we've example about querygetcell. We created query using queryNew() then we got the last title column value using querygetCell. If we give row number displays the particular row title value otherwise it displays last row value.

<cfset myQuery = queryNew("id,name","integer,varchar",[[1,"Rajesh"],[2,"Anil"]])>
<cfoutput>#querygetcell(myQuery,'name')#</cfoutput>

Expected Result: Anil

Here we've the example to get particular column(title) value in script syntax

<cfscript>
var myQuery = queryNew("id,title","integer,varchar",[[1,"Charlottes Web"],[3,"The Outsiders"],[4,"Mieko and the Fifth Treasure"]]);
writeOutput(myQuery.getCell('title',2));
</cfscript>

Expected Result: The Outsiders

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub