Article

How to add the .NET Crystal Reports Viewer into a form?

« Go Back

Information

 
Article Number000013225
EnvironmentProduct: OpenEdge
Version: 10.2x, 11.x
OS: Windows
Other: Crystal Reports .NET
Question/Problem Description
How to add the .NET Crystal Reports Viewer control into a form?
Why is it not possible to add CrystalReportViewer .NET controls to the Visual Designer, as well as some other controls of Crystal Reports?
Steps to Reproduce
Clarifying Information
Error Message
Defect/Enhancement Number
Cause
Resolution
We intentionally filter the Crystal Reports controls from the toolbox and also prevent users from adding these controls from Add Controls dialog directly.

The issue comes from the hard-coded dependency that the CrystalReportViewer .NET Control has with the Microsoft Visual Studio environment. Progress cannot fix the issue unless this dependency on the Microsoft Visual Studio environment is removed from the Crystal Reports assemblies.

However it is still possible to utilize Crystal .NET controls in your OpenEdge Project by using the Assembly References Tool to add the Crystal references.

The attached basic example shows the steps:

1) In PDSOE or Procedure Editor, add Assembly References to the Project.
- Right-click on the Project and select Properties.
- Expand OpenEdge and select Assemblies.
- Click Add to display the "Add Assembly References" dialog.
- In the Global Assemblies tab, Filter on "CrystalDecisions" to display Crystal assemblies.
- Select the required assemblies and click OK.

The assemblies will appear in Referenced Assemblies in the Project.

Similar steps are described for the Procedure Editor in the following article:

How to add custom .NET DLL's in the Procedure Editor?
Article 000060216, How to add custom .NET DLL's in the Procedure Editor?
 
2) Use this User Control (ReportViewer.cls) to wrap the Crystal Report Viewer.

At this point this User Control can't be added graphically to any form, since Crystal Reports Definitions in InitializeComponent method invalidate any graphic support for this file. All modifications need to be done directly in the code.

The attached sample code is created to work with a sample sports2000 database.  If testing with other database then any parameter in this example code needs to be updated according to the other database.
 
3) The User Control can now be added to an ABL Form. In this example form1.cls is provided to run an ABL form and include the Crystal Report Viewer.

Note: It is possible to call the CrystalReportViewer programmatically but this approach will require more manual coding. Article  shows an example:

How to create a Crystal Report with .Net CrystalDecisions assembles and export the report to a .pdf file
Article 000056268, How to create a Crystal Report with .Net CrystalDecisions assembles and export the report to a .pdf file

4) Instantiate an object of form1.cls and run the form. (see run_cr.p)

To run the attached sample:
  1. Export all files in sample_cr.zip file
  2. Create a sports2000 database
  3. Update parameters if needed in ReportViewer.cls
  4. Compile code with compile_sample.p
  5. Open a proenv window and run run_cr.p:
Proenv> prowin32 –p run_cr.p
 
** This is a sample report and code to test functionality, it’s not intended to be used in production as it is. 
 
Workaround
Notes
References to other documentation:

Progress article(s):


000060216, "How to add custom .NET DLL's in the Procedure Editor?"
000056268, "How to create a Crystal Report with .Net CrystalDecisions assembles and export the report to a .pdf file "


The information above assumes that the appropriate edition of the SAP / Business Objects Crystal Reports product and it's prerequisites have been installed which contains the required assemblies. 
If the required assemblies are not available then customers are advised to contact SAP Technical Support for further assistance.

** Trial version of Crystal Reports 13 does not include the run-time libraries.
 

Attachment
Last Modified Date10/24/2017 9:49 AM


Feedback
 
Did this article resolve your question/issue?

   

Your feedback is appreciated.

Please tell us how we can make this article more useful. Please provide us a way to contact you, should we need clarification on the feedback provided or if you need further assistance.

Characters Remaining: 1025