CAML Query with Nested OR's and AND's using SPServices

时间:2015-10-06 08:33:42

标签: sharepoint-2010 caml spservices

I have used this post a reference CAML query with nested AND's and OR's for multiple fields. The difference for mine is I do not need AND's with nested OR's inside of them.

I have the nested OR's working by themselves, however I need to add in three AND conditions. I'm not quite sure how to do this with the nested OR's .

My goal is as follows with a sample code included below. Test-1 is equal to A or B or C and Test-2 is equal to D and Test-3 is equal to E and Test-4 is equal to F.

<Where>
    <And>
        <Or>
            <Eq>
                <FieldRef Name='Test-1' />
                <Value Type='Text'>A</Value>
            </Eq>
                <Or>
                    <Eq>
                        <FieldRef Name='Test-1' />
                        <Value Type='Text'>B</Value>
                    </Eq>
                    <Eq>
                        <FieldRef Name='Test-1' />
                        <Value Type='Text'>C</Value>
                    </Eq>
                </Or>
        </Or>
        <And>
            <Eq>
                <FieldRef Name='Test-2' />
                <Value Type='Text'>D</Value>
            </Eq>
            <Eq>
                <FieldRef Name='Test-3' />
                <Value Type='Text'>E</Value>
            </Eq>
            <Eq>
                <FieldRef Name='Test-4' />
                <Value Type='Text'>F</Value>
            </Eq>
        </And>
    </And>
</Where>

Thanks for the help

1 个答案:

答案 0 :(得分:0)

使用U2U而不是其他软件,我可以通过删除和移动AND来解决我的问题。