I have an update statement in coldfusion.

I have a 6 criteria A, B, C, D, E or F

  <cfif CMTEE_PREF_NEW EQ "A" or "B" or "C" or "D" or "E" or "F">
                                          CMTEE_PREF_NEW = <cfqueryparam value = "#form.CMTEE_PREF_NEW#" cfsqltype="cf_sql_char" />,                                                                  
                                          <cfelse>
                                          CMTEE_PREF_NEW = <cfqueryparam value = " " cfsqltype="cf_sql_char" />,
                                          </cfif>  

How i'm able to have to correct this

  <cfif CMTEE_PREF_NEW EQ "A" or "B" or "C" or "D" or "E" or "F">
LVL 4
koilaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

_agx_Commented:
> <cfif CMTEE_PREF_NEW

I'm heading to sleep soon, but ..what is "CMTEE_PREF_NEW"  .. a form field? If so, use list functions:

<cfif listFindNoCase("A,B,C,D,E,F", FORM.CMTEE_PREF_NEW)>
         CMTEE_PREF_NEW = <cfqueryparam value = "#form.CMTEE_PREF_NEW#"
                                                  cfsqltype="cf_sql_char" />,                                                                  
 <cfelse>
          CMTEE_PREF_NEW = <cfqueryparam value = " " cfsqltype="cf_sql_char" />,
</cfif>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
IrogSintaCommented:
listFind or listFindNoCase would be better to use.
<cfif listFindNoCase("A,B,C,D,E,F", FORM.CMTEE_PREF_NEW)> 
    <!--- found --->
 <cfelse>
    <--- not found --->     
</cfif>

Open in new window

Otherwise, you'd have to write your OR expression this way:
 <cfif CMTEE_PREF_NEW EQ "A" or CMTEE_PREF_NEW EQ "B" or CMTEE_PREF_NEW EQ "C" or CMTEE_PREF_NEW EQ "D" or CMTEE_PREF_NEW EQ "E" or CMTEE_PREF_NEW EQ "F">
0
Gurpreet Singh RandhawaCEOCommented:
an Update: even if it is not coming from form you can do it like this

<cfset form.CMTEE_PREF_NEW = CMTEE_PREF_NEW> [Here you put this into form Scope]

<cfif listFindNoCase("A,B,C,D,E,F", FORM.CMTEE_PREF_NEW)>
    <!--- found --->
 <cfelse>
    <--- not found --->    
</cfif>

or like this

[This may take more time as it will search all scopes, but will not make big difference as list is quite small]
<cfif listFindNoCase("A,B,C,D,E,F", CMTEE_PREF_NEW)>
    <!--- found --->
 <cfelse>
    <--- not found --->    
</cfif>
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

koilaAuthor Commented:
Hi Agax,

thank you.  If I don't check any box of question 2, i'm having this error.  How i'm able to resolved please help me. thank you!

Element CMTEE_PREF_NEW is undefined in FORM.  <br>The error occurred on line 52.

on line 52 I have this code line.

<cfif listFindNoCase("POL,SOP,EE,ADMIN,TF,ANY", FORM.CMTEE_PREF_NEW)>

This is the front end of question 2:
-============================

<table border="0" cellspacing="0" cellpadding="0" width="100%" class="qtable">
            <tr>
              <td colspan="2" height="5" width="100%">
                <input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF1" value="POL"
<cfif listFindNoCase(DisplayCVITool.CMTEE_PREF, "POL")>checked</cfif>>
                &nbsp;
                <label>Policy setting committees (POL)</label>
                <br>
                <input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF2" 
value="SOP"
<cfif listFindNoCase(DisplayCVITool.CMTEE_PREF, "SOP")>checked</cfif>>
                &nbsp;
                <label>Standard of practice setting committees (SOP)</label>
                <br>
                <input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF3" 
value="EE"
<cfif listFindNoCase(DisplayCVITool.CMTEE_PREF, "EE")>checked</cfif>>
                &nbsp;
                <label>
                Committees related to education and eligibility issues <em>(EE)</em></
                label><br>
                <input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF4" 
value="ADMIN"
<cfif listFindNoCase(DisplayCVITool.CMTEE_PREF, "ADMIN")>checked</cfif>>
                &nbsp;
                <label>Administrative committees such as Finance or Elections <em>(ADMIN)</em></label>
                <br>
                <input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF5" 
value="TF"
<cfif listFindNoCase(DisplayCVITool.CMTEE_PREF, "TF")>checked</cfif>>
                &nbsp;
                <label>Task Forces (typically short term commitment) <em>(TF)</em></label>
                <br>
                <input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF6" 
value="ANY"
<cfif listFindNoCase(DisplayCVITool.CMTEE_PREF, "ANY")>checked</cfif>>
                &nbsp;
                <label>Doesn’t matter, I just want to volunteer. <em>(ANY)</em></label>
                 <br>
                <input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF7" 
value="SP"
<cfif listFindNoCase(DisplayCVITool.CMTEE_PREF, "ANY")>checked</cfif>>
                &nbsp;
                <label>Specialist Volunteer Groups (such as the Actuarial Foundation of Canada) <em>(SP)</em></label></td>
            </tr>
          </table>

Open in new window

confirmation-e.txt
0
_agx_Commented:
@koila  - Checkbox fields will only exist if something was checked.  There's 2 ways to handle it:

- Use cfparam at the top of the page to assign a default value. That'll ensure the field always exists  ie

       <cfparam name="FORM.CMTEE_PREF_NEW" default="">

- The other is to verify it exists *before* using it in an expression, ie  Use

<cfif structKeyExists(FORM, "CMTEE_PREF_NEW") AND
        listFindNoCase("POL,SOP,EE,ADMIN,TF,ANY", FORM.CMTEE_PREF_NEW)>
         CMTEE_PREF_NEW = <cfqueryparam value = "#form.CMTEE_PREF_NEW#"
                                                  cfsqltype="cf_sql_char" />,                                                                  
 <cfelse>
          CMTEE_PREF_NEW = <cfqueryparam value = " " cfsqltype="cf_sql_char" />,
</cfif>
0
koilaAuthor Commented:
I will test.  You are the best expert.   Pls review my others questions pls pls
0
_agx_Commented:
I'll check it out as soon as I'm done w/my meetings.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.