Crystal Reports is a business intelligence application used to design and generate reports from a wide range of data sources. Several other applications, such as Microsoft Visual Studio, bundle an OEM version of Crystal Reports as a general purpose reporting tool.
Why Use a Reporting Tool?
It isn't difficult to retrieve data. You could write code to loop through record sets and print them in your Windows or Web application. In the .NET Framework, you could go further and bind that data to a control, such as a Repeater, DataList or DataGrid.
But to present this data in a formal report format is far more complex. Report features, such as consolidations, multiple level totals, charting, conditional formatting, and page-based output are difficult and time-consuming to program. Crystal Reports makes it easy to create and distribute complex reports.
Report Types
Crystal Report Designer can load reports that are included into the project as well as those that are independent of the project.
Strongly-typed Report:
When you add a report file into the project, it becomes a ‘strongly-typed’ report. In this case, you will have the advantage of directly creating an instance of the report object, which could reduce a few lines of code, and caching it to improve performance. The related .vb file, which is hidden, can be viewed using the editor’s ‘show all files’ icon in the Solution Explorer.
Un-Typed Report:
Those reports that are not included into the project are ‘un-typed’ reports. In this case, you will have to create an instance of the Crystal Report Engine’s 'ReportDocument' object and manually load the report into it.
Embedded report:
An embedded report is a report that has been imported into, or created within, a Visual Studio project. When a report is embedded into the project, a wrapper class is automatically generated for the report.
Non-embedded reports:
A non-embedded report is a report that is external to the Visual Studio project. You can use many ways to access the report and load it into an object model (to enable programmatic interaction with the report), but the report always remains external to the project.
Creating reports
Users install Crystal Reports on a computer and use it to select specific rows and columns from a table of compatible data. Users can then arrange the data on the report in the format needed. Once the report layout is complete it is saved as a file with the extension RPT. A report can be rerun anytime by reopening the RPT file and 'refreshing' the data. If the source data has been updated then the refreshed report will reflect those updates. The report can then be previewed on the screen, printed onto paper or exported to one of several different file formats such as PDF, Excel, text or CSV.
Report formats can vary from a simple column of values to layouts featuring pie charts, bar charts, cross-tab summary tables and nested subreports. Crystal Reports is designed for "presentation quality" reports so there are many options for enhanced formatting.
Fetching the data for the Crystal Report could be done by using any of the following methods:
Pull Model:
Where in Crystal Report handles the connection to the database using the specified driver and populates the report with the data, when requested.
Push Model:
Where it is the developer who has to write code to handle the connection and populate the dataset, and pass it on to the report. The performance can be optimized in this manner by using connection sharing and manually limiting the number of records that are passed on to the report.
What are cached reports?
Cached reports are report objects that have been stored in the ASP.NET Cache object, to increase performance and scalability. Crystal Reports supplies a specific framework for placing ReportDocument instances in the Cache. That framework automatically caches any report that implements the ICachedReport interface.
What is the ASP.NET Cache object?
In both ASP and ASP.NET, report objects are placed in Session or Application on the Web server, for two reasons:
1. 1. To persist the state of the report object across page reloads.
2. 2. To improve scalability and performance by placing large or slow-to-load reports into server memory.
In ASP.NET, an augmented variation of the Application object called Cache was introduced. Like Application, Cache still persists single instances of a report object, to be shared by all users. However, Cache adds intelligence that looks for file-based, key-based or time-based dependencies. These dependencies can automatically expire and even refresh report objects within the Cache, to keep the contents of the Cache current.
Running reports locally
The users who design the reports can run them as needed from within the report designer. When running reports directly within the report designer the user has the ability to change any feature of the report. The user can also create variations of the report by saving the modified RPT file under another name.
It is also possible to run a Crystal Report without using the full Crystal Reports designer software. These alternate methods for running reports include locally installed viewers, schedulers, and report distribution tools. These are typically third-party software programs (independent of Business Objects) that allow you to open, refresh, preview, print and export an RPT file. In 2007 Business Objects released their own viewer, Crystal Reports Viewer XI, but unlike the independent viewers it does not allow the user to refresh the report, but only to view static data saved in the RPT file.
Some of the independent viewers add other capabilities such as allowing the user to schedule a report to run automatically at certain times. Still others allow reports to be burst and/or distributed via Email.