Charlie,

Tried the code on cflib.org.  It did the case that I desired, but it also
caused the content in the displayed field (property) to duplicate, showing
same value for all records.  See code and link below.

link: http://hotdeals.com/datatesting2.cfm

<head>
<cfquery name="groups" datasource="xxxx"  >
SELECT DISTINCT dest
  FROM tableb
 WHERE top10 = "1" AND description = ' ';
</cfquery>

<cfloop query="groups">

    <cfquery name="top10" datasource="xxxxx"  >
        SELECT dest, property, url_e, price, description
          FROM tableb
         WHERE top10 = "1" AND description > ' '
           AND dest = <cfqueryparam maxlength="20" value="#groups.dest#">
         LIMIT 5
    </cfquery>

<!--- Either print here, or combine in one large query, using QueryNew()
outside the loop and QueryAddRow() for each result --->

<cffunction name="CapFirst" returntype="string" output="false">
    <cfargument name="str" type="string" required="true" />

    <cfset var newstr = "" />
    <cfset var word = "" />
    <cfset var separator = "" />

    <cfloop index="word" list="#arguments.str#" delimiters=" ">
        <cfset newstr = newstr & separator & UCase(left(word,1)) />
        <cfif len(word) gt 1>
            <cfset newstr = newstr & right(word,len(word)-1) />
        </cfif>
        <cfset separator = " " />
    </cfloop>

    <cfreturn newstr />
</cffunction>
<CFSET str="#top10.property#">

<cfoutput query="top10" group="dest">
  <b>#top10.dest#</b><br>
<table>
  <cfoutput><tr>
<td >#CapFirst(str)#</td><td>#UCASE(top10.Description)#</td>
<td>$#top10.price#.00</td><td><a href="#top10.url_e#"
target="_blank">More</a></td>


</tr></cfoutput>
</table>  </cfoutput>
</cfloop>

</head>


On Tue, Jul 24, 2012 at 11:04 AM, Charlie Arehart <[email protected]>wrote:

> Michael, I realize you only just wrote a few minutes ago, and may still be
> working on a response to my earlier note.
>
> As for your need for capitalizing the first words, I don’t know if you
> wanted a SQL solution, but for a CFML solution, that’s a great example of
> when to look at the good ol’ cflib.org site, which has thousands of
> user-defined functions to do just the most flexible things. Searching there
> for “capitalize” found this as the first hit:
> http://www.cflib.org/udf/CapFirst
>
> Let us know if that (and the group code I offered, and the code to limit
> the inner loop) is helpful.****
>
> ** **
>
> /charlie****
>
> ** **
>
> *From:* [email protected] [mailto:[email protected]] *On Behalf Of *Michael
> Brown
> *Sent:* Tuesday, July 24, 2012 10:56 AM
> *To:* [email protected]
> *Subject:* Re: [ACFUG Discuss] Have a question about group limits****
>
> ** **
>
> Thanks Larry,
>
> I'm only querying about 4k records for this project, so the query is
> rather quick.  But I will definitely snippet the code for future projects.
> BTW, would you have a string snippet for capitalizing the first letter of
> each work in a title output?
>
> ex. "the brown dog" - converted to "The Brown Dog".
>
> ****
>
> ** **
>
> -------------------------------------------------------------
> To unsubscribe from this list, manage your profile @
> http://www.acfug.org?fa=login.edituserform
>
> For more info, see http://www.acfug.org/mailinglists
> Archive @ http://www.mail-archive.com/discussion%40acfug.org/
> List hosted by FusionLink <http://www.fusionlink.com>
> -------------------------------------------------------------




-- 
Michael Brown
770-605-5240

Marketing Solutions with vision!
http://www.singleconcepts.com

Reply via email to