cancel
Showing results for 
Search instead for 
Did you mean: 

CR 2008 Dynamically Sorting

Former Member
0 Kudos

I have a report that I allow the sorting order to be defined by the End User. Multiple choices can be selected for each sorted column (I allow 3 different sorts on same report). When I am receiving an error when running the report and can not find either the correct approach or a method to achieve the sorting I need. Here is a quick code sample (field name modified for readability, but same value):

crReport.DataDefinition.SortFields(0).Field = crReport.Database.Tables(My.Settings.EmployeeTable).Fields("")

crReport.DataDefinition.SortFields(0).SortDirection = SortDirection.AscendingOrder

crReport.DataDefinition.SortFields(1).Field = crReport.Database.Tables(My.Settings.EmployeeTable).Fields("")

crReport.DataDefinition.SortFields(1).SortDirection = SortDirection.AscendingOrder

Thrown exception:

"Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))"

The exception is thrown on the first line.

I am using Crystal Reports 2008 with Visual Studio 2005.

Any help would be greatly appreciated.

Steve

View Entire Topic
former_member183750
Active Contributor
0 Kudos

I'm not sure what patch level you are on, but you should at least be on [Service Pack 2|https://smpdl.sap-ag.de/sapidp/012002523100009038092009E/cr2008win_sp2.exe] and preferably Fix Pack [2.7|https://smpdl.sap-ag.de/sapidp/012002523100005755702010E/cr2008fp27.exe] on top of that.

Also, see [this|] forum thread for a possible solution.

Ludek

Follow us on Twitter

http://twitter.com/SAPCRNetSup