How do you make an added row from QueryAddRow() the first row of the result from a query?
Posted
by JS
on Stack Overflow
See other posts from Stack Overflow
or by JS
Published on 2010-05-31T01:48:20Z
Indexed on
2010/05/31
1:52 UTC
Read the original article
Hit count: 192
coldfusion
|coldfusion-8
I am outputting a query but need to specify the first row of the result. I am adding the row with QueryAddRow() and setting the values with QuerySetCell(). I can create the row fine, I can add the content to that row fine. If I leave the argument for the row number off of QuerySetCell() then it all works great as the last result of the query when output. However, I need it to be first row of the query but when I try to set the row attribute with the QuerySetCell it just overwrites the first returned row from my query (i.e. my QueryAddRow() replaces the first record from my query). What I currently have is setting a variable from recordCount and arranging the output but there has to be a really simple way to do this that I am just not getting. This code sets the row value to 1 but overwrites the first returned row from the query.
<cfquery name="qxLookup" datasource="#application.datasource#">
SELECT xID, xName, execution
FROM table
</cfquery>
<cfset QueryAddRow(qxLookup)/>
<cfset QuerySetCell(qxLookup, "xID","0",1)/>
<cfset QuerySetCell(qxLookup, "xName","Delete",1)/>
<cfset QuerySetCell(qxLookup, "execution", "Select this to delete",1)/>
<cfoutput query="qxLookup">
<tr>
<td>
<a href="##" onclick="javascript:ColdFusion.navigate('xSelect/x.cfm?xNameVar=#url.xNameVar#&xID=#qxLookup.xID#&xName=#URLEncodedFormat(qxLookup.xName)#', '#xNameVar#');ColdFusion.Window.hide('#url.window#')">#qxLookup.xName#</a>
</td>
<td>#qxLookup.execution#</td>
</tr>
</cfoutput>
</table>
Thanks for any help.
© Stack Overflow or respective owner