Click to See Complete Forum and Search --> : Cold Fusion - 1 return for multiple records


djw808
12-01-2005, 10:50 PM
I am seeking some help with populating a drop down list with records based on a CF Query. I can reurn all records based on the query but I am wanting to only return a record once if it is the same as another. Ie if there are 7 records that equal "Project Manager", I only want to display it once in the drop down list.

I am using (have to use) Cold Fusion 4.5

Thanks in Advance

Ubik
12-02-2005, 02:25 PM
Use the "GROUP" attribute in your CFQUERY.

<cfoutput
query = "query_name"
group = "query_column"
groupCaseSensitive = "Yes" or "No">
</cfoutput>

djw808
12-05-2005, 05:54 PM
Thanks Ubik, that helped a lot. Although it now leads me to another question. I wish to apply a different style to the alternate rows in the drop down that are returned from the DB.

If apply a class to the first dynamic <option> tag I get that class style for it and every following record. How can I alternate the class (and therefore the style) for each of the dynamic <option> tags?

Thanks.

-----------

<select name="key" id="loc_key" class="job_drop_menu">
<option value="" selected="selected">Select a current vacancy location</option>
<cfoutput group = "title2">
<option value="#title2#" class="option1">#title2#</option>
<cfset counter = counter + 1>
</cfoutput>
</select>

chrismartz
12-12-2005, 10:15 PM
use something like below<cfset color = AlternateColor(color1="##FFFFFF", color2="##F7F7F7", row=#query.CurrentRow#)>