Solved

Multiple OR operator in CAML?

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

We had a requirement to extract data from a SharePoint 2010 Customer List into a CSV file and then place the CSV file into a directory on the network so that the file could be consumed by an AS400 system. I will share in Part 1 how to Extract the Da…
In case you ever have to remove a faulty web part from a page , add the following to the end of the page url ?contents=1
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

713 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