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>"
6
  • 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, 2020 at 13:11
  • Hello Urs, only AND! Jul 9, 2020 at 13:20
  • Is this multiple selection lookup field? Jul 9, 2020 at 13:22
  • Hello Ganesh, no simple lookup... Jul 9, 2020 at 13:22
  • Then how this condition will satisfy? In single selection you can select only one value one list item Jul 9, 2020 at 13:24

1 Answer 1

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

Your Answer

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

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