开发者

SharePoint CAML query for following condition

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 开发者_如何学Go22,23,Yes 16 And 56 are some mock values.

Thanks in advance! Sachin


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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜