Solved

Nested Caml Or Statements

Posted on 2011-09-06
3
469 Views
Last Modified: 2012-05-12
Hello Experts,

Basically, I am trying to write this psuedo-code in CAML.

WHERE
(myList.Title = "Search String") AND
(myList.Field1 = "Some other string") AND
(myList.Field2 = "Yet another string" OR myList.Field3 = "Yet another string" OR myList.Field4 = "Yet another string OR myList.Field5 = "Yet another string")

I can't use LINQ because this is SharePoint 2007.

I have tried using U2U but it doesn't do the OR line in the query and returns nothing. Any help would be appreciated.

Thanks!
0
Comment
Question by:freezegravity
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
ivan_vagunin earned 500 total points
ID: 36493709
Hi!
The Caml should be following:
<Where>
    <And>
        <Eq><FieldRef Name='Title'/><Value Type='Text'>Search String</Value></Eq>
        <And>
             <Eq><FieldRef Name='Field1'/><Value Type='Text'>Some other string</Value></Eq>
             <Or>
                 <Eq><FieldRef Name='Field2'/><Value Type='Text'>Yet another string</Value></Eq>
                 <Or>
                      <Eq><FieldRef Name='Field3'/><Value Type='Text'>Yet another string</Value></Eq>
                      <Or>
                             <Eq><FieldRef Name='Field4'/><Value Type='Text'>Yet another string</Value></Eq>
                             <Eq><FieldRef Name='Field5'/><Value Type='Text'>Yet another string</Value></Eq>
                      </Or>
                 </Or>
             </Or>
        </And>
    </And>
</Where>
0
 

Author Comment

by:freezegravity
ID: 36504464
Thanks a ton! Worked beautifully!
0
 
LVL 18

Expert Comment

by:ivan_vagunin
ID: 36504879
Welcome)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

When installing SharePoint 2010 RTM I came across a strange error, I was getting timeouts during the installation. I searched the web and found the best solution to be found here (http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010genera…
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

828 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