> I have a collection to pull up records based on a text
> string that a user
> types in. My queries based on my collection return the
> correct data.
> However, the data is like this...
[snip]
Ok here's a cludge fix, which may have some use sometime.
-----8<-----8<-----8<-----8<-----8<-----
<cfquery name="myQuery" datasource="myData">
SELECT firstItem, secondItem
FROM myTable
WHERE x = y
</cfquery>
<cfset oldFirstItem = 'somethingthatwillneverbe'>
<table>
<cfoutput query="myQuery">
<tr>
<td>
<cfif firstItem NEQ oldFirstItem>
<cfset oldFirstItem = firstItem>
#oldFirstItem#
<cfelse>
</cfif>
</td>
<td>
#secondItem#
</td>
</tr>
</cfoutput>
</table>
-----8<-----8<-----8<-----8<-----8<-----
What's 'appenin' 'ere is... we set a variable "oldFirstItem" to
something which you'll never have in your database. Then as we go
through the query/loop we check to see the current firstItem is any
different to the "oldFirstItem", if it is, then we know we've changed
"group". So display the new heading, set the oldFirstItem to whatever
the current firstItem is... and move onto the next record. If the
next record's firstItem is the same, then it doesn't get displayed.
Note the use of to fill the cell on the table with a blank
space, your formatting needs may of course vary.
I'm sure there's a performance hit in doing this, but it'll give the
result you want, without that nasty "group" thing :)
Dan.
This message is intended only for the use of the person(s) ("the intended
recipient(s)") to whom it is addressed.
It may contain information which is privileged and confidential within the meaning of
the applicable law. If you are not the intended recipient, please contact the sender
as soon as possible.The views expressed in this communication may not necessarily be
the views held by Live Information Systems Limited.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.