Responsive Ads Here

Tuesday, December 2, 2014

CAML Query Joins and Projections

In SQL Joins are used to get the data of two or more tables based upon a relationship.Using Joins, we can combine two or more tables and gather data with a single query.

Similarly in SharePoint we have a good feature  to get the data from one or more tables using Joins by Caml query. But there is no way to write Joins using Caml designer. 

I have found a nice tool to write Joins using Caml query in CodePlex.  CamlJs (SharePoint JavaScript Caml Builder) simplifies creation of SharePoint Caml queries using client-side scripts which can be used with either SharePoint Client Object Model or Sp-services.

We can checkout the features of CamlJs documentation and usage by clicking here CamlJs.

we have two flavors of CamlJs.One is CamlJs Console and another one is extension which is available in Chrome web store.  Using this extension we can check join condition in browser it self ( please find the below screenshot). But it works only in Google chrome.





Sp-query has two properties to get the data from two or more tables based on a relationship. 

  • Joins : Used to join the lists based on relationship.
  • Projected Fields :  Specifies the fields in joined lists that can be included in the view.  
Please find the complete documentation by visiting this blog post.  Joins have some limitations 

1. Data Table is not supported when we use joins.
2. Multiple Lines of text, Choice type columns are not supported in the Projected fields.

We have discussed how to write Joins on SharePoint List using different tools. Stay tuned for this post how to use this query both in server side and client object model.








No comments:

Post a Comment