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

Accepted Solutions (1)

Accepted Solutions (1)

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

Answers (1)

Answers (1)

Former Member
0 Kudos

Yes, I had SP2 and then later applied Fix Pack 2.7 when it was released. I reposted this problem (and forgot to remove this thread) giving more details and a better extraction of the code segment.

Here is a link to the follow-up thread posted:

Thank you for responding (on both threads).

Steve

former_member183750
Active Contributor
0 Kudos

Oh, sorry about that. Kinda funny though - giving you your own solution... I never realized it was the same user ID - just did not bother looking at that.

Ludek