Solved

Nested Caml Or Statements

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I recently came across an issue with a MOSS 2007 deployment where access into some sub-sites were denied, even for the MOSS farm administrators. A bit of background to the setup of this MOSS farm; this was a three server setup, consisting of a fr…
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 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.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

13 Experts available now in Live!

Get 1:1 Help Now