Tridion 2011 SP1 HR2
I am having trouble getting multiple sort orders added via the .Net api.
We have multiple custom meta fields as below:
Order Items (Added in this order)
FieldName FieldType MetaDataType Order
resource_category Category String Asc
year Category String Asc
resource_material Category String Asc
Query
using (var query = new Tridion.ContentDelivery.DynamicContent.Query.Query(criteriaBuilder.Criteria))
{
if (orders != null)
{
foreach (var item in orders)
{
var sort = new CustomMetaKeyColumn(item.FieldName, item.MetaDataType);
query.AddSorting(new SortParameter(sort, item.Ascending ? SortParameter.Ascending : SortParameter.Descending));
}
}
var ids = query.ExecuteQuery();
return ids;
}
Example data:
Resource1 | A Category | 1941 | Report
Resource2 | B Category | 1981 | Report
Resource3 | A Category | 1984 | Document
Resource4 | B Category | 1980 | Report
Expected Result:
Resource1 | A Category | 1941 | Report
Resource3 | A Category | 1984 | Document
Resource4 | B Category | 1980 | Report
Resource2 | B Category | 1981 | Report
Actual Result:
Resource3 | A Category | 1984 | Document
Resource1 | A Category | 1941 | Report
Resource2 | B Category | 1981 | Report
Resource4 | B Category | 1980 | Report
In other words it only applies the last sort parameter applied.
There was mention in another post that this was a known issue See Here but that was July last year.
I am having issues trying to access the support system and can not find mention of this in the live docs etc so thought I would ask here.
Does anyone know if there has been an update to this or perhaps another way of implementing this via the api (trying to avoid dirtying custom code)
Thanks in advance