views:

21

answers:

1

Hi All,

Can any one tell me what would me the CAML query for the following condition

[[Col1=22 And Col2=23] OR [Col3=Yes] ] And [ [Col4=16] OR [Col5=56 ] ]

Where Col1,Col2,Col3,Col4,Col5 are the columns of my list and 22,23,Yes 16 And 56 are some mock values.

Thanks in advance! Sachin

+2  A: 

This should work. Basically, you have to start writing the query with the AND outside the parenthesis and work your way into the groupings.

<Where>
    <And>
        <Or>
            <And>
                <Eq>
                    <FieldRef Name='Col1' />
                    <Value Type='Text'>22</Value>
                </Eq>
                <Eq>
                    <FieldRef Name='Col2' />
                    <Value Type='Text'>23</Value>                   
                </Eq>
            </And>
            <Eq>
                <FieldRef Name='Col3' />
                <Value Type='Boolean'>1</Value>
            </Eq>
        </Or>
        <Or>
            <Eq>
                <FieldRef Name='Col4' />
                <Value Type='Text'>16</Value>
            </Eq>
            <Eq>
                <FieldRef Name='Col5' />
                <Value Type='Text'>56</Value>
            </Eq>
        </Or>
    </And>
</Where>
DylanW
I admire your courage and give you a well deserved vote :) When I realized that I didn't have the CAML query builder installed on my laptop, I instantly gave up!
Philippe