Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to sort records dynamically at runtime in crystal reports?

Status
Not open for further replies.

menazbk

Programmer
Dec 24, 2001
6
EG
I am using VB .NET to view crystal reports in the crystal report viewer activeX control, and I am using the CrystalDecisions.CrystalReports.Engine.ReportDocument class to load reports dynamically at runtime and add conditions and sorting options at runtime too. I use the record selection formula to add conditions at runtime. The problem is that I want to ADD sorting options (fields and sort direction) at runtime, but I can't. Can anyone help please? Thank you in advance.
 
I had this very issue answered this morning by Crystal. Here is the e-mail as i recieved it:

The sort field can not be added at runtime using vb.net with crystal reports you can only do this using the RDC with crystal reports, the only thing you can do is change the field you are sorting at runtime but the field must already exist on the report. Here is a code sample of how to do
this:

Dim cr As New CrystalReport1 cr.DataDefinition.SortFields(0).Field =
cr.Database.Tables(0).Fields("Customer")
//Customer is the field that will change to sort on

Regards,
George N,
Dev Team

This stinks, but it is the way it is.
 
Thank you very much for your fast reply.

I would like to know if using the CRAXDRT.ReportClass class instead of the CrystalDecisions.CrystalReports.Engine.ReportDocument class in VB .NET would not cause any problems.

Thank you in advance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top