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: 3726

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...

<Query />
<FieldRef Name="ID"/>
<FieldRef Name="Title"/>
<FieldRef Name="ParentTitle"/>
<FieldRef Name="GrandParentTitle"/>
<Join Type="LEFT" ListAlias="Parents">
<FieldRef Name="ParentLookupField" RefType="Id"/>
<FieldRef List="Parents" Name="ID"/>
<Join Type="LEFT" ListAlias="GrandParents">
<FieldRef List="Parents"
Name="GrandParentLookupField" RefType="Id"/>
<FieldRef List="GrandParents" Name="ID"/>
<Field Name="ParentTitle Type="Lookup" List="Parents"
<Field Name="GrandParentTitle" Type="Lookup"
List="GrandParents" ShowField="Title"/>

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

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

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



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