Hi,
Concept: Pass your query "data" into a temp query. In the
first field, drop in your #Location# - #LocName#. That becomes your
select "display" field. Then create a second field, drop in your
#LocName#. This becomes your "value" field. The code below should
be pretty easy to follow. (I use the code to drop in a blank row at
the top of my cfselect as this typically bombs when you "bind" on
cfselect.)
<CFFUNCTION NAME="getCategory" ACCESS="remote"
returnType="query">
Review QueryNew and QuerySetCell to help you out.
cfwild
<CFSET var data="">
<CFQUERY NAME="data" DATASOURCE="#DSN#" >
SELECT DISTINCT #TP#_#SESSION.tableName#.Category
FROM #TP#_#SESSION.tableName#;
</CFQUERY>
<!--- Add Blank Row (For No Filter) & Sort for
CFSelect --->
<CFSET totalRows = (data.recordcount+1)>
<CFSET getCategory = QueryNew("Category", "VarChar")>
<CFSET newRow = QueryAddRow(getCategory, totalRows)>
<CFSET temp = QuerySetCell(getCategory, "Category", "",
1)>
<CFSET counter = 2>
<CFLOOP QUERY="data">
<CFSET temp = QuerySetCell(getCategory, "Category",
Category, counter)>
<CFSET counter = counter+1>
</CFLOOP>
<CFRETURN getCategory>
</CFFUNCTION>