Are there settings in Crystal Reports that modify sort order of data sources?
I'm working with Crystal Reports in VB.NET in Visual Studio 2005.
I have a List(Of Stuff) that I've sorted according to one of the object's members.
I've verified in the debugger that the list is sorted correctly.
When I define my list as the data source, as in
rptDetails.Subreports.Item("rptSubReport").SetDataSource(theListOfStuff)
and view the report, the list is reversed.
So, looking for a workaround, I said, "OK, I'll sort the list backwards before binding it."
The list still appeared backwards in the report.
So something's happening, and I think it's within the report definition, because I don't know where else the sort order could be changed. Any suggestions?
(Oh, forgot to ment开发者_运维技巧ion that I used the report design facilities within VS to lay out the report.)
Thanks as always.
This link might help: MSDN Link
This is what I suspected:
CR does not retain any previous sorting for a dataset. Its default sort is based on the first column in ascending order. You have to reapply your sorting criteria to CR.
You could just try:
Dim subRpt as ReportDocument
subRpt = rptDetails.Subreports.Item("rptSubReport")
subRpt.DataDefinition.SortFields(0).SortDirection = CrystalDecisions.Shared.SortDirection.DescendingOrder
精彩评论