Solved

Multiple OR operator in CAML?

Posted on 2010-09-01
3
709 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

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 …
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

930 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

16 Experts available now in Live!

Get 1:1 Help Now