Solved

Multiple OR operator in CAML?

Posted on 2010-09-01
3
699 Views
Last Modified: 2012-08-13
SELECT * FROM Applicants WHERE Position='a' or Position='b' or Position='c' or Position='d' or Position='f' or Position='g' or Position='h' or Position='i'

How to convert the above SQL to CAML?
0
Comment
Question by:PagodNaUtak
  • 2
3 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
Comment Utility
Try:
<Where>

  <Or>

     <Eq><FieldRef Name='Position'/><Value Type='Text'>a</Value></Eq>          

     <Eq><FieldRef Name='Position'/><Value Type='Text'>b</Value></Eq>

     <Eq><FieldRef Name='Position'/><Value Type='Text'>c</Value></Eq>

     <Eq><FieldRef Name='Position'/><Value Type='Text'>d</Value></Eq>

     <Eq><FieldRef Name='Position'/><Value Type='Text'>f</Value></Eq>

     <Eq><FieldRef Name='Position'/><Value Type='Text'>g</Value></Eq>

     <Eq><FieldRef Name='Position'/><Value Type='Text'>h</Value></Eq>

     <Eq><FieldRef Name='Position'/><Value Type='Text'>i</Value></Eq>

  </Or>

</Where>

Open in new window

0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
Comment Utility
Actually that probably won't work, you'll need to use nested OR's:

<Where>

  <Or>

     <Or>

        <Or>

           <Or>

              <Or>

                 <Or>

                    <Or>

                      <Eq><FieldRef Name='Position'/><Value Type='Text'>a</Value></Eq>          

                      <Eq><FieldRef Name='Position'/><Value Type='Text'>b</Value></Eq>

                    </Or>

                    <Eq><FieldRef Name='Position'/><Value Type='Text'>c</Value></Eq>

                 </Or>

                 <Eq><FieldRef Name='Position'/><Value Type='Text'>d</Value></Eq>

              </Or>

              <Eq><FieldRef Name='Position'/><Value Type='Text'>f</Value></Eq>

           </Or>

           <Eq><FieldRef Name='Position'/><Value Type='Text'>g</Value></Eq>

        </Or>

        <Eq><FieldRef Name='Position'/><Value Type='Text'>h</Value></Eq>

     </Or>

     <Eq><FieldRef Name='Position'/><Value Type='Text'>i</Value></Eq>

  </Or>

</Where>

Open in new window

0
 
LVL 8

Author Comment

by:PagodNaUtak
Comment Utility
i will check and will give you feedback ASAP...
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now