473,809 Members | 2,724 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sorting Crystal Reports programmaticall y

Hello,

I'm still learning Crystal reports, and now I need to sort report
programmaticall y. 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.Table s[0].Fields[sortField];
objReport.DataD efinition.SortF ields[0].Field = FieldDef;
objReport.DataD efinition.SortF ields[0].SortDirection =
CrystalDecision s.Shared.SortDi rection.Descend ingOrder;

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

objReport.DataD efinition.SortF ields[0].Field = FieldDef;

Exception from HRESULT: 0x8002000B (DISP_E_BADINDE X))

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
programmaticall y?

I would appreciate your help.

Thank you,

Peter
Jun 27 '08 #1
0 1941

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

Similar topics

0
1165
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 with VS.NET 2002/2003)? I've seen some examples based on Crystal Report 9 Application Server (RAS), using the class ChartStyle (here's the URL: http://support.crystaldecisions.com/communityCS/FilesAndUpdates/ras9_csharp_win_newchart.exe.asp).
3
6919
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
5035
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. I created the websetup and built the MSI, have the bundled version. Copied to webserver and ran Websetup.msi. Said I had to remove old version, which I did, then reran WebSetup.msi and keeps giving me this error. "The installer was interrupted...
3
1841
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 VS.NET but I have not used that before Also is it possible to send the same PDF to the printer programmatically using crystal reports
2
7556
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 = new COM ("CrystalRuntime.Application") or die ("Error on
0
1212
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 these reports in my .NET application programmatically so that the need for loca DSN is no longer required. Any help is greatly appreciated. Bill
0
1770
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 using requires v.1.4. v.1.6 will mess up the application itself. PDFversion.exe (a conversion utility) doesn't support the 1.6 format and Acrobat 7 doesn't want to do backwards conversion on a PDF Form (at least from what I can see). So... I...
0
1050
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). However, none of the embedded formulas work when the report is printed/viewed using VB6 (I'm NOT using the Crystal designer in VB; instead I'm doing CreateObject("CrystalRuntime.Application") to hook into the crystal engine). Oddly, I can pass the...
2
11919
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 the information of a bunch of objects. The actual data is numeric. Since these reports are meant to be flexible number formatting must be configured as defined by the requirements. For example, sometimes the values will have to be rounded to 5...
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10633
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10114
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9198
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.