You've lost me now. What does the form field look like. Not like this:

<input type="checkbox" name="floor" value="1" /> 1
<input type="checkbox" name="floor" value="2" /> 2
<input type="checkbox" name="floor" value="3" /> 3
<input type="checkbox" name="floor" value="4" /> 4

???

Ade

-----Original Message-----
From: Orlini, Robert [mailto:[EMAIL PROTECTED]
Sent: 17 January 2006 20:16
To: CF-Talk
Subject: RE: Search two values in one field


Actually I would like separate values. Basically search the "floor" field
for any occurrence of one or a combination of numbers 1-6. For example, I
select checkboxes for floors 3 and 4 and get a list of records with floors
having 3 and 4 not 3,4.

How would the query look then?

-----Original Message-----
From: Adrian Lynch [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 17, 2006 3:08 PM
To: CF-Talk
Subject: RE: Search two values in one field


Or this is always handy:

<cfset list = "Event 1,Event 2">

<cfquery name="temp" datasource="#REQUEST.DSN#">
        SELECT * FROM Event
        WHERE Label IN (<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#list#"
list="yes">)
</cfquery>

>From my tables, not yours, but you get the idea.

Adrian

-----Original Message-----
From: Adrian Lynch [mailto:[EMAIL PROTECTED]
Sent: 17 January 2006 20:02
To: CF-Talk
Subject: RE: Search two values in one field


If I understand this correctly, you'll be getting a value of 1,2 back in
FORM.floor. If that's the case, this should work:

<cfquery name="Getfloor" datasource="inventory">
        SELECT * FROM inventory WHERE 0 = 0
        <cfif IsDefined("FORM.floor") and form.floor NEQ "">
                AND floor IN (#form.floor#)
        </cfif>
</cfquery>

But that's only if the values of the checkboxes are numbers. If they're
strings, try this instead:

AND floor IN #ListQualify(FORM.floor, "'")#

Adrian

-----Original Message-----
From: Orlini, Robert [mailto:[EMAIL PROTECTED]
Sent: 17 January 2006 19:31
To: CF-Talk
Subject: Search two values in one field


How do I implement a search of two different values in one field?

I want to search for floors 3 and 4 in the field named "floor" and display a
report. Then html form uses checkboxes for each floor.

Here is my previous search statement with one floor per search; how can I
modify it? Thanks!

<cfquery name="Getfloor" datasource="inventory">
SELECT * FROM inventory where 0 = 0

<CFIF IsDefined("FORM.floor") and form.floor NEQ "">
        And floor = '#trim(form.floor)#'
</CFIF>
</cfquery>

Robert Hww






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:229800
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to