Hello all,

I want to take a comma delimited list created in a Search form, and
check to see if any of the elements in that list is contained in a field
in the database which is also comma delimited in a compound CFQUERY
statement.

SO...form.coatings = "1,5,10,13"

The field coatings in the database contains "1,3,14".

So therefore that record will be a part of the resultset.

The next record coatings field may contain "7,8,9" and therefore should
NOT be a part of the resultset.


The SQL I tried was:

<CFQUERY name="sresults" datasource="napca">

SELECT * FROM tblMembers

WHERE 0=0
<CFIF IsDefined("membertype") AND #membertype# NEQ 0>

        AND member_type = #form.membertype#

</CFIF>
<CFIF IsDefined("form.company") AND #form.company# NEQ "">

        AND company_name LIKE '%#form.company#%'

</CFIF>

<CFIF IsDefined("form.coating_search")><!--- If the user selected a
coating search option then check for coatins --->

        <!--- Loop through every coating that the user multiselected on
the search form --->

                AND coatings CONTAINS '#ListFirst(form.coatings)#' 

        <!---DEBUGGING <CFLOOP list="#form.coatings#" index="coating">
                
                OR coatings = '#coating#'
        
        </CFLOOP> DEBUGGING --->

</CFIF>



</CFQUERY>

I was just testing the correct syntax with just checking for one element
of the form field list. But I keep getting syntax errors.

How can I accomplish this??

-Gel

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to