Logo 
Search:

Sharepoint 2010 Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint 2010       RSS Feeds

SharePoint 2010 CAML Joins - Cannot sort on a projected field?

  Asked By: Adya    Date: Dec 09    Category: Sharepoint 2010    Views: 3455

I have an XsltListViewWebPart and would like to show my list grouped in
two levels. "MyList" has a lookup field to "ParentList" which has a
lookup field to "GrandParentList". I would like to sort and group by
"GrandParentTitle", then "ParentTitle". Here's the View XML prior to
the sort and group...


<View>
<Query />
<ViewFields>
<FieldRef Name="ID"/>
<FieldRef Name="Title"/>
<FieldRef Name="ParentTitle"/>
<FieldRef Name="GrandParentTitle"/>
</ViewFields>
<Joins>
<Join Type="LEFT" ListAlias="Parents">
<Eq>
<FieldRef Name="ParentLookupField" RefType="Id"/>
<FieldRef List="Parents" Name="ID"/>
</Eq>
</Join>
<Join Type="LEFT" ListAlias="GrandParents">
<Eq>
<FieldRef List="Parents"
Name="GrandParentLookupField" RefType="Id"/>
<FieldRef List="GrandParents" Name="ID"/>
</Eq>
</Join>
</Joins>
<ProjectedFields>
<Field Name="ParentTitle Type="Lookup" List="Parents"
ShowField="Title"/>
<Field Name="GrandParentTitle" Type="Lookup"
List="GrandParents" ShowField="Title"/>
</ProjectedFields>
<RowLimit>2000</RowLimit>
</View>

This works, and the list displays the Parent and GrandParent fields
perfectly. When I try to add sorting, however, the GrandParent fields
are blank. I did this by replacing the "<Query/>" element with the
following:

<Query>
<OrderBy>
<FieldRef Name="GrandParentTitle" Ascending="TRUE"/>
<FieldRef Name="ParentTitle" Ascending="TRUE"/>
</OrderBy>
</Query>

The GrandParent data disappears leaving that column blank for all rows.
Any ideas?

Share: 

 

No Answers Found. Be the First, To Post Answer.

 




Tagged: