Did you try:  trim(GetProductTypes.Code)

I sometimes run into this problem where the db will pad the field with
spaces and when I run a query, the spaces are returned and my if logic
craps out. Almost always, a trim will do the trick.

Mark



-----Original Message-----
From: Michael Wilson [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 28, 2002 5:22 PM
To: CF-Talk
Subject: Filtering Query Results


Hi all,
 
I have a query, GetProductTypes:
 
<cfquery name="GetProductTypes" datasource="#request.dsn#" 
dbtype="ODBC"
username="#username#" password="#password#">
SELECT   DISTINCT producttypes.Code, producttypes.ID,
producttypes.SortOrder, products.ProductCategoryID,
products.ProductTypeID, products.OrderOnlineStatus
FROM  producttypes, products
WHERE  products.ProductCategoryID = 28
AND   producttypes.ID = products.ProductTypeID
AND   products.OrderOnlineStatus = 1
ORDER BY producttypes.SortOrder
</cfquery>
 
that returns a list of product types within category 28; say
 
ASO (black)
ASO (white)
ASO Speed Lacer
Air-Gel
 
The products returned from the query are correct. I need to look at this
list of returned products and display only those that have "ASO" in the
"Code" field. I don't want to display the Air-Gel. Is there a way to
filter the query results before displaying them?
 
I tried this:
 
<cfif GetProductTypes.Code CONTAINS "ASO">
<cfoutput query="GetProductTypes">
#Code#<br>
</cfoutput>
<cfelse> error message
</cfif>
 
.but it always returns false, even when GetProductTypes.Code contains
ASO. I bet I am missing something really simple. :( Any help would be
greatly appreciated.
 
I am using CF 4.5 on a Win NT box.
 
Thank you,
 
Mike
 
Michael Wilson - 961 Media, Inc=======================
[EMAIL PROTECTED] 
http://www.961media.com <http://www.961media.com/> =======================
Phone 704.736.9009 
Mobile 704.281.7616=======================
Don't let anyone ever make you 
feel like you don't deserve what 
you want.
 


______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to