473,320 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Sorting Crystal Reports programmatically

Hello,

I'm still learning Crystal reports, and now I need to sort report
programmatically. I've found a good article about it:
http://blogs.ittoolbox.com/c/coding/...atically-16201.
This is how it described there:

ReportDocument objReport = new ReportDocument();
objReport.Load("Your report path");
FieldDefinition FieldDef;
FieldDef = objReport .Database.Tables[0].Fields[sortField];
objReport.DataDefinition.SortFields[0].Field = FieldDef;
objReport.DataDefinition.SortFields[0].SortDirection =
CrystalDecisions.Shared.SortDirection.DescendingOr der;

When I try to do this, I'm getting an error on this line:

objReport.DataDefinition.SortFields[0].Field = FieldDef;

Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))

This error is also described in this article:

"This is because you didn't define any sort field in your crytal report...
so if you try to add a FieldDef to the SortFields at a specified index and
that index doesn't exist then you will get the error..."

But there is no explanation how to define the sort fields in the report.
I've searched the Google and found several posts about the same issue, but
also no explanation.

So how can I define the sort fields for the report so I could sort
programmatically?

I would appreciate your help.

Thank you,

Peter
Jun 27 '08 #1
0 1914

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Wilson Ricardo Passos Oliveira | last post by:
Hi fellows, I have a simple question: Does anybody ever tried to change programmatically a graph style (from bar to pizza, etc.) using Crystal Reports 9 for Visual Studio .NET (which comes...
3
by: Gheaci Maschl | last post by:
Hi all! I would like to have your opinion about my problem and my proposal how to solve it: Ingredients: - BTriev database - Crystal Reports - maybe MS Access - Liinos6 (small ERP software)
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
3
by: Andrew | last post by:
hello Is it possible to create a PDF document from an HTML file using Crystal decisions. I have a .html file which I want to turn into a PDF programmatically.I have crystal reports as part of...
2
by: MartyInOz | last post by:
Hi, I'm currently running Crystal Reports 8.5 from PHP using COM..(yes I know that is an older version of Crystal)...I am also running PHP on localhost. The following code: <?php $crapp =...
0
by: Bill nguyen | last post by:
I created many Crystal Reports reports using DSN connection at design time. I must also create corresponding DSN's in client PC for them to be able to access these reports. I would like to call...
0
by: Wayne Deleersnyder | last post by:
I've been looking on the web trying to find a solution to converting a PDF Form from v.1.6(Acrobat 7) to PDF v1.4(Acrobat 5). It's one of those weird situations where one of the applications I'm...
0
by: vingtquatre | last post by:
Ijust upgraded from Crystal Reports 6 to Crystal Report XI. Existing reports (lots of them) were converted apparently OK. (That is, they looked fine when viewed with Crystal's design preview)....
2
Pittaman
by: Pittaman | last post by:
Hello I am creating some crystal reports (for visual studio 2005) based on the content of certain .NET objects. I'm doing this in .NET 2.0. For one of them I'm using a Cross-table to summarize...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.