Solved

Multiple OR operator in CAML?

Posted on 2010-09-01
3
728 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
ID: 33575163
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
ID: 33575227
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
ID: 33575290
i will check and will give you feedback ASAP...
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

856 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