0

I need to display the elements in Column "NetworkNodes" only SRV1 and SRV3 in Lookup, how to write correctly?

The remaining elements of the SRV are not needed.

Doesn't work like that:

Query = @"<Where><And><Eq><FieldRef Name='NetworkNodes' /><Value Type='Lookup'>" + "SRV1" + "</Value></Eq><Eq><FieldRef Name='NetworkNodes' /><Value Type='Lookup'>" + "SRV3" + "</Value></Eq></And></Where>"
  • Do you really want to query for SRV1 and SRV3, or do you mean to for or? The stated query will only give you items containing both values. – Urs Jul 9 at 13:11
  • Hello Urs, only AND! – Fox Jul 9 at 13:20
  • Is this multiple selection lookup field? – Ganesh Sanap Jul 9 at 13:22
  • Hello Ganesh, no simple lookup... – Fox Jul 9 at 13:22
  • Then how this condition will satisfy? In single selection you can select only one value one list item – Ganesh Sanap Jul 9 at 13:24
2

If the lookup column does not allow to select multiple values then you should try your query like:

<Where>
    <Or>
        <Eq>
            <FieldRef Name='NetworkNodes'/>
            <Value Type='Lookup'>SRV1</Value>
        </Eq>
        <Eq>
            <FieldRef Name='NetworkNodes'/>
            <Value Type='Lookup'>SRV3</Value>
        </Eq>
    </Or>
</Where>
| improve this answer | |
  • 1
    Thanks Ganesh :)) – Fox Jul 9 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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