1

I have a list with a lookup column in it. (name: colParent)

I can query the list with Eq, and get the correct results (2 results returned for 224).

<Eq>
  <FieldRef Name='colParent' LookupId='TRUE' />
  <Value Type='Lookup'>224</Value> 
</Eq>

However, I do the same query with "In", and get no results.

<In>
  <FieldRef Name='colParent' LookupId='TRUE' />
  <Values>
    <Value Type='Lookup'>224</Value>
  </Values>
</In>

(in the actual query, there will be multiple lookup Ids, so I need to use "In")

What's even weirder - this list is in a SP-hosted app that I developed. I installed the app in 2 sites. The "In" query works in one, but not in the other. So the query should be correct, its just not working in one site.

Any ideas? I'm going crazy over this one.

  • There is a software called u2u caml query builder which can be used to design queries and then run them inside the app, try it maybe it resolves your problem. – Nderon Hyseni Mar 29 '18 at 20:53
  • u2u does not have support for "In" queries. Also, I'm pretty sure the query is technically correct since it does return the correct results in a different site. – J. Lee Mar 29 '18 at 21:09
  • What happens if you use "Type='Integer'"? – Mike Smith - MCT - MVP Mar 29 '18 at 21:16
  • Hmmm - that worked! I wonder why Lookup works for Eq but not for In... And why it works on one site, but not the other. I guess I don't need to know now. Thanks Mike! – J. Lee Mar 29 '18 at 21:29
  • 1
    @MikeSmith-MCT-MVP kindly post it as answer since it solved OP's question – Abdul Hameed Mar 30 '18 at 6:07
0

Using Type='Integer' for the values fixed the issue. Thanks Mike Smith!

<In>
  <FieldRef Name='colParent' LookupId='TRUE' />
  <Values>
    <Value Type='Integer'>224</Value>
  </Values>
</In>
| improve this answer | |

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