My datasource is a flatdatasource that I get from a webservice. I have provided a simplified version of my data object here as an example.
class Data { string EmployeeName; Address EmployeeAddress; int Sales; }
Now, when I try to sort by Address, I can add a hierarchy descriptor with different levels and sort in terms of City, State, etc.
However, I also want to be able to sort by EmployeeName (For example: Bob Smith, John Doe). Is there a way to assign an expression to the EmployeeName dimension to sort by last name?
Hello,
When you use the LevelDefaultSortDirections collection, then you have to specify the level's unique name – it should follow this format [DimensionName].[HierarchyName].[LevelName]
Hope this helps you.
Thanks Stefan for following up.
Unfortunately, this does not work, Does not do any form of sorting, the order in which items are displayed seem to random.
I am doing the following in code behind:
LevelSortDirection ld = new LevelSortDirection();ld.LevelUniqueName = @"[EmployeeName]:[EmployeeName]";ld.SortDirection = ListSortDirection.Ascending;ds.LevelDefaultSortDirections.Add(ld);
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
You can set default sort directions for each level:
<olap:FlatDataSource.LevelDefaultSortDirections>
<olap:LevelSortDirection LevelUniqueName="[Date].[Date].[Years]" SortDirection="Ascending"/>
</olap:FlatDataSource.LevelDefaultSortDirections>
Best regards,Plamen.
Any suggestions here?