Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Multiple OR operator in CAML?

Posted on 2010-09-01
3
Medium Priority
?
754 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 2000 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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

Note:  There are two main ways to deploy InfoPath forms:  Server-side and directly through the SharePoint site.  Deploying a server-side InfoPath form means the form is approved by the Administrator, thus allowing greater functionality in the form. …
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

876 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