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

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