Solved

Nested Caml Or Statements

Posted on 2011-09-06
3
451 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

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…
For SharePoint sites, particularly public-facing ones, there are times when adding JavaScript, Meta Tags, CSS Styles or other content to the page <head> section is more practical than modifying master pages.  For instance, you could add the jQuery l…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

919 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

12 Experts available now in Live!

Get 1:1 Help Now