Solved

Multiple OR operator in CAML?

Posted on 2010-09-01
3
745 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
SharePoint Designer 2010 has tools and commands to do everything that can be done with web parts in the browser, and then some – except uploading a web part straight into a page that is edited in SPD. So, can it be done? Scenario For a recent pr…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

624 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