Skip to main content
August 28, 2006
Question

Help with a query

  • August 28, 2006
  • 2 replies
  • 325 views
I am working on a search system, that allows admins to return very specific data. The most important part of the search is returning a certain columns results as a list. The problem I have is this.

When I run my test, I get an array of stuctures output like this.
1
struct
ADDRESS 1222 W Baseline Road
AGENTLIST Patrick Richardson
COE 05/31/2005
FILENUM S051990
MLSNUM [empty string]
PRICE 158875
STATUS Closed
2
struct
ADDRESS 1222 W Baseline Road
AGENTLIST Jason Robinson
COE 05/31/2005
FILENUM S051990
MLSNUM [empty string]
PRICE 158875
STATUS Closed

But I need the returned output to look like this.
1
struct
ADDRESS 1222 W Baseline Road
AGENTLIST Patrick Richardson,Jason Robinson
COE 05/31/2005
FILENUM S051990
MLSNUM [empty string]
PRICE 158875
STATUS Closed


I have tried looping over the results and creating a list based on the returned objects from the query. But it only places the first record int he list and outputs that only.

This is my current code that I am trying below. Can someone give me a hand with this?

This topic has been closed for replies.

2 replies

Inspiring
August 28, 2006
Note to Ian. The macromedia site version of this uses square brackets to create html. For example [the letter i] gets interpreted as the html <i> tag. Notice how it looks here: http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=1&catid=7&threadid=1187622&enterthread=y

Just thought you'd like to know.
Inspiring
August 28, 2006
The group attribute of <cfoutput> would help with this task.

This is not debugged or tested, but should get you close.

<cfoutput query="SaleSearchQry" group="fld_partName">
<cfset searchArr = structNew()>
<cfset searchArr
.fileNum = SaleSearchQry.fld_fileNum>
<cfoutput>
<cfset searchArr .agentList =
listAppend(searchArr
.agentList,SaleSearchQry.fld_partyName)>
</cfoutput>
<cfset searchArr .mlsNum = SaleSearchQry.fld_mlsNum>
<cfset searchArr
.status = SaleSearchQry.fld_propStatus>
<cfset searchArr .address = SaleSearchQry.fld_propAddress>
<cfset searchArr
.coe = SaleSearchQry.fld_propCoe>
<cfset searchArr .price = SaleSearchQry.fld_propPrice>
<cfset i = i + 1>
</cfoutput>