2

I am trying to execute the following query:

query.Query =<Where>
 <IsNotNull>
  <FieldRef Name='Product' />
 </IsNotNull>
</Where>
<OrderBy>
 <FieldRef Name='CountryCode4' Ascending='FALSE' />
</OrderBy>

query.Join = <Join Type='LEFT' ListAlias='ProductList'>
 <Eq>
  <FieldRef Name='Product' RefType='Id' />
  <FieldRef List='ProductList' Name='ID' />
 </Eq>
</Join>
<Join Type='LEFT' ListAlias='AuthorisationLookupList'>
 <Eq>
  <FieldRef List='ProductList' Name='MarketingAuthorisationLookup' RefType='Id' />
  <FieldRef List='AuthorisationLookupList' Name='ID' />
 </Eq>
</Join>
<Join Type='LEFT' ListAlias='AuthorisationStatusLookupList'>
 <Eq>
  <FieldRef List='AuthorisationLookupList' Name='AuthorisationStatusLookup' RefType='Id' />
  <FieldRef List='AuthorisationStatusLookupList' Name='ID' />

When applying sorting the column "CountryCode" is empty and sorting has not taken place. If, however, I sort by the column "Title" everything works fine. Would anybody have a clue as to why and if what I am trying to achieve is even possible?

2

Rafal,

I know this question is quite old, but just came across this post.. If we look at following link, which explains the Limitations of CAML Joins: JOINS AND PROJECTIONS IN SHAREPOINT 2010

It says:

Limitations

  • There is no way to leverage joins and projections in a view through the UI. CAML must be written. Few things are more badass than CAMLs, but they're often hairy. (Get it...? Maaan I crack myself up)
  • Joins can only be defined on lookup columns
  • Projected fields cannot be used to sort or group in the view
  • Dynamic sorting and filtering in listview webparts is also not supported
  • Projected columns do not show up correctly in datasheet view, or when exported to Excel

Point 3 explains why your query is not working.

1
  • Ha! Thank you Arsalan for taking the time to answer that old question. Nov 7 '13 at 18:55

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.