0

I've a query that goes like this:

                <In>
                <FieldRef Name='Industry'/>
                <Values>
                    <Value Type='Text'>Insurance</Value>
                </Values>                 
                </In>

I would expect it to be equivalent to this:

                <Eq>
                <FieldRef Name='Industry'/>
                <Value Type='Text'>Insurance</Value>
                </Eq>

But the first one returns 3 results and the second one around 400. Also, the column i'm querying against is a Choice one. If I add one value to that column and then remove it, it stops to appear in the first query. Am I missing something? Does In operator works as I supposed?

And, is there any reason for my result to stop appear in my first query after I modify the column? (It keeps not appearing even when I remove the new element, so it's as it was before)

1 Answer 1

0

The In operator is used to compare the query with multiple dynamic values.

In your case, I would suggest using <Eq> with choice as a value type instead of Text as below

<Eq>
    <FieldRef Name='Industry'/>
    <Value Type='Choice'>Insurance</Value>
</Eq>

In case, the choice field is MultiChoice, you have to use <Value Type='MultiChoice'>Insurance</Value> but in this case, it will return all items that contain Insurance word

1
  • Hello, my problem is, I need to do it with an <In>, as there are columns with more than one value. If I do it with an Eq, I would not be getting these results. My main question is, shouldn't an "In" operator returns all results with "Insurance" in the Choice column? May I use other column type to do this? Right now it is not getting the results it should. I think it's a metadata problem. Could you shed light on this matter? I'm kind of lost! Thank you in advance!
    – Des
    Commented Jan 18, 2023 at 10:15

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.