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

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 491
  • Last Modified:

Nested Caml Or Statements

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
freezegravity
Asked:
freezegravity
  • 2
1 Solution
 
ivan_vaguninCommented:
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
 
freezegravityAuthor Commented:
Thanks a ton! Worked beautifully!
0
 
ivan_vaguninCommented:
Welcome)
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now