0

I have this SQL query and it works perfectly. However, when I try to create a similar CAML it doesn't work. Is there a tool that can convert SQL to CAML. or can someone please help. Here is the SQLFiddle. http://sqlfiddle.com/#!18/0557ef/10

select assignedto
from sample_approvers_list
where
libraryname='packaging' and level='a' and LineName = 'pure'
or
(libraryname='packaging' and level='a' and AnyLine='Yes')

enter image description here

<Where>
    <And>
        <Eq>
            <FieldRef Name='Library' />
            <Value Type='Lookup'>Packaging</Value>
        </Eq>
        <And>
            <Eq>
                <FieldRef Name='Level' />
                <Value Type='Choice'>A</Value>
            </Eq>            
            <Or>
                <Eq>
                    <FieldRef Name='LineName' />
                    <Value Type='Lookup'>PURE</Value>
                </Eq>
                <And>
                    <Eq>
                        <FieldRef Name='AnyLine' />
                        <Value Type='Boolean'>1</Value>
                    </Eq> 
                    <Eq>
                        <FieldRef Name='AnyPlace' />
                        <Value Type='Boolean'>1</Value>
                    </Eq>
                </And>          
            </Or>           
        </And>
    </And>  
</Where>

1 Answer 1

0

the following CAML worked.

<Query>
<ViewFields>
    <FieldRef Name="AssignedTo" />
</ViewFields>
<Where>
    <And>
        <Eq>
            <FieldRef Name='Library' />
            <Value Type='Lookup'>Packaging</Value>
        </Eq>
        <And>
            <Eq>
                <FieldRef Name='Level' />
                <Value Type='Choice'>A</Value>
            </Eq>            
            <Or>
                <Eq>
                    <FieldRef Name='Line' />
                    <Value Type='Lookup'>PURE</Value>
                </Eq>               
                    <Eq>
                        <FieldRef Name='AnyLine' />
                        <Value Type='Boolean'>1</Value>
                    </Eq>               
            </Or>
        </And>
    </And>
</Where>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.