1

Using SP2013 - JavaScript - $().SPServices() - operation 'GetListItems' - how would I construct a CAML query that will join two lists where list 'A' has a reference to list 'B' specifically having a where clause on a text field in list 'A' as well as a where clause on a text field in list 'B'?

For example, list 'BookTitles' has a reference to list 'Authors'. I would like to pull back all book titles having the title 'Absence' and Author 'John Freeman'. Knowing the list of Book Titles has more than one entry for the title 'Absence' given this title is given to 7 different stories - each a story having the same title but a different author - I would expect my result set to be a single row - the book title 'Absence' related specifically to author 'John Freeman'.

  • 1
    AFAIK, the CAML Join only works server side. You have to make 2 separate calls to the lists, store the result sets, then parse through the results looking for what you need. – Eric Alexander Aug 13 '15 at 17:43
  • 1
    Not sure about CAML join but this is supported in REST api. You might want to give that a try. – Akhoy Aug 13 '15 at 18:39
  • @uberz91 - please elaborate. Using $().SPServices() which I believe is SOAP based - not REST. Ultimately (as seen by fiddler) the call is to lists.asmx - which is a standard SOAP endpoint... – barrypicker Aug 13 '15 at 18:50
  • Yes. What I meant was, you could try another approach instead of getlistitems. In REST, it is much easier to execute a join. – Akhoy Aug 13 '15 at 18:54
  • @uberz91 - example please... – barrypicker Aug 13 '15 at 18:55
3

CAML joins, to my knowledge, only work on the server side. To mimic that on the client side, you have to make several calls, storing the results in objects or arrays, parsing through that, and making further calls.

This isn't a limitation of SPServices, but the underlying web services themselves.

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.