THIS IS REALLY CLOSE - THANK YOU SO FAR :-) The actual list inf feature codes come from a different query and for that matter a different table...here is the code for the first query....I almost had this working and then went through a block So it needs to read the list of feature_codes from the first query then display the matching feature_description in the second query....still with me? :-/ is this really easier than I'm making it out to be? ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- <CFQUERY name="getlistings" datasource="flidx_data" MAXROWS="10"> SELECT * FROM listings WHERE listings.TLN_FIRM_ID = '2014415' OR listings.TLN_FIRM_ID = '242913' OR listings.TLN_FIRM_ID = '2010937' ORDER BY sale_price DESC </CFQUERY> <!--- Get the feature codes ---> <cfquery name="featureCodesQuery" ...> select feature_code, feature_description from featureCodes </cfquery> <!--- Put the feature codes into a struct ---> <cfset featureCodes = {}> <cfloop query="featureCodes"> <cfset featureCodes[feature_code] = feature_description> </cfloop> <!--- Display the feature codes ---> <cfloop index="code" list="#FEATURE_CODES#" delimiters="#chr(44)#"> <cfif structKeyExists(featureCodes,code)> #featureCodes[code]# <cfelse> #code# </cfif> </cfloop> -----------------------------------------------------------------------------------------------------------------------------
On Mon, May 31, 2010 at 8:12 PM, Kevan Stannard <ke...@stannard.net.au>wrote: > > Hi Bill, this is the idea I was getting at: > > <!--- Get the feature codes ---> > <cfquery name="featureCodesQuery" ...> > select feature_code, feature_description > from featureCodes > </cfquery> > > <!--- Put the feature codes into a struct ---> > <cfset featureCodes = {}> > <cfloop query="featureCodes"> > <cfset featureCodes[feature_code] = feature_description> > </cfloop> > > <!--- Display the feature codes ---> > <cfloop index="code" list="#FEATURE_CODES#" delimiters="#chr(44)#"> > <cfif structKeyExists(featureCodes,code)> > #featureCodes[code]# > <cfelse> > #code# > </cfif> > </cfloop> > > > On 1 June 2010 09:43, Bill Hartley <b...@whdservices.com> wrote: > > > > > Is there a way I can do it with in the CF code on the page itself and not > > in > > the select statement in the query? > > > > Something like > > <cfset fullname="#MLS_AGENT_NAME#"> > > #gettoken(fullname,2,",")# #gettoken(fullname,1,",")# > > <HR><BR></CFOUTPUT> > > <cfset codelist="#FEATURE_CODES#"> > > <cfloop index="code" list="#codelist#" delimiters="#chr(44)#"> > > <CFIF code EQ "#featurecodes.feature_codes#"> > > #featurecodes.description# > > <CFELSE> > > #code# > > </CFIF> > > </cfloop> > > > > I know this this code is totally wrong but thats the situation that would > > help me the most....anybody know the correct way to concieve of this? > > > > On Sat, May 29, 2010 at 1:45 AM, Kevan Stannard < > kevan.stann...@gmail.com > > >wrote: > > > > > > > > A simple option for you is to load all of your feature codes into a > > > structure then loop through your feature codes list and just pull the > > > feature code descriptions from the struct. > > > > > > On 29/05/2010 12:37 PM, "Bill Hartley" <b...@whdservices.com> wrote: > > > > > > > > > I am trying to display feature codes from a comma delimited list inside > a > > > database. Here is my setup: > > > > > > Table: Listings has a column called FEATURE_CODES and example of the > data > > > in > > > this column is "B01,E09,E20,G12,J07" > > > > > > Then I have another table inside the same database called FeatureCodes > > the > > > data inside this table is arranged > > > FEATURE_CODE FEATURE_DESCRIPTION > > > B01 Sold As Is > > > E09 Frame and Stucco > > > and so on.... > > > I need to display the feature description from the FeatureCodes table > on > > > the > > > display page by reading the feature_codes from the listing table > > > > > > Any Suggestions?? Please!! > > > > > > > > > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334167 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm