Because the Crystal Report viewer components are shared across both the Crystal Enterprise Embedded Edition and the Crystal Enterprise Professional/Premium editions, there must be a common interface defined so the viewer can display reports generated using both types of report processing engines. This interface is called the report source. The report source is an object that both the Embedded edition and Professional/Premium editions supply that the viewer in turn communicates with to render the reports to the various forms of HTML.
There are three types of report sources:
NOTE
Because of the special functionality of the Interactive and Grid viewers, they do not work with a Page Serverbased report source.
The Java code in Listing 32.1 illustrates the first scenario where a report source object is obtained from the standalone Report Application Server.
//First you must create a new ReportClientDocument object ReportClientDocument reportClientDoc = new ReportClientDocument(); //After the ReportClientDocument is created, you then need to //specify the report file that is to be used as the report //source: String path = "C:\Program Files\Crystal Decisions\Report Application Server" + " 10\Reports\Sample.rpt"; reportClientDoc.open(path, openReportOptions._openAsReadOnly); //Finally use the openReportSource method to return the report source object IReportSource reportSource = reportClientDoc.getReportSource();
NOTE
All the code listings provided in this chapter are provided in JSP/Java. Although the .NET/COM and the Java flavors of the RAS SDK share identical functionality, there are obviously language nuances associated with each of them. Code samples for additional language flavors are available for download from the www.usingcrystal.com Web site.
Listing 32.2 illustrates obtaining a report source when using the Report Application Server as part of Crystal Enterprise. Notice that the same ReportClientDocument object is used. The difference is in how the ReportClientDocument object is obtained.
For more information on using the IEnterpriseSession as associated Crystal Enterprise objects, p. 767
//Retrieve the IEnterpriseSession object previously stored in the users session. IEnterpriseSession enterpriseSession = (IEnterpriseSession) session.getAttribute("EnterpriseSession"); //Use enterpriseSession object to retrieve the reportAppFactory object IReportAppFactory reportAppFactory = (IReportAppFactory) enterpriseSession.getService("", "RASReportFactory"); //Open the report document by specifying the report ID ReportClientDocument reportClientDoc = reportAppFactory.openDocument(reportID, 0, Locale.ENGLISH); //Finally use the openReportSource method to return the report source object IReportSource reportSource = reportClientDoc.getReportSource();
An alternative way to do this is shown in Listing 32.3.
//Retrieve the IEnterpriseSession object. IEnterpriseSession enterpriseSession = (IEnterpriseSession) session.getAttribute("EnterpriseSession"); //Use the IEnterpriseSession objects getService method to get //an IReportAppFactory object. IReportSourceFactory reportFactory = (IReportSourceFactory) enterpriseSession.getService("", "RASReportFactory"); //Use IReportAppFactory objects openReportSource method, passing it //the report ID to return the reportSource object IReportSource reportSource = reportFactory.openReportSource(reportID, Locale.ENGLISH);
Listing 32.4 illustrates obtaining a report source object from the Page Server service from Crystal Enterprise Professional/Premium.
//Retrieve the IEnterpriseSession object previously stored in the users session. IEnterpriseSession enterpriseSession = (IEnterpriseSession) session.getAttribute("EnterpriseSession"); //Use the getService method of the EnterpriseSession object to obtain an //IReportAppFactory object: IReportSourceFactory reportFactory = (IReportSourceFactory) enterpriseSession.getService ("", "PSReportFactory"); //Finally use the openReportSource method to return the report source object IReportSource reportSource = reportFactory.openReportSource(reportID, Locale.ENGLISH) ;
Part I. Crystal Reports Design
Creating and Designing Basic Reports
Selecting and Grouping Data
Filtering, Sorting, and Summarizing Data
Understanding and Implementing Formulas
Implementing Parameters for Dynamic Reporting
Part II. Formatting Crystal Reports
Fundamentals of Report Formatting
Working with Report Sections
Visualizing Your Data with Charts and Maps
Custom Formatting Techniques
Part III. Advanced Crystal Reports Design
Using Cross-Tabs for Summarized Reporting
Using Record Selections and Alerts for Interactive Reporting
Using Subreports and Multi-Pass Reporting
Using Formulas and Custom Functions
Designing Effective Report Templates
Additional Data Sources for Crystal Reports
Multidimensional Reporting Against OLAP Data with Crystal Reports
Part IV. Enterprise Report Design Analytic, Web-based, and Excel Report Design
Introduction to Crystal Repository
Crystal Reports Semantic Layer Business Views
Creating Crystal Analysis Reports
Advanced Crystal Analysis Report Design
Ad-Hoc Application and Excel Plug-in for Ad-Hoc and Analytic Reporting
Part V. Web Report Distribution Using Crystal Enterprise
Introduction to Crystal Enterprise
Using Crystal Enterprise with Web Desktop
Crystal Enterprise Architecture
Planning Considerations When Deploying Crystal Enterprise
Deploying Crystal Enterprise in a Complex Network Environment
Administering and Configuring Crystal Enterprise
Part VI. Customized Report Distribution Using Crystal Reports Components
Java Reporting Components
Crystal Reports .NET Components
COM Reporting Components
Part VII. Customized Report Distribution Using Crystal Enterprise Embedded Edition
Introduction to Crystal Enterprise Embedded Edition
Crystal Enterprise Viewing Reports
Crystal Enterprise Embedded Report Modification and Creation
Part VIII. Customized Report Distribution Using Crystal Enterprise Professional
Introduction to the Crystal Enterprise Professional Object Model
Creating Enterprise Reports Applications with Crystal Enterprise Part I
Creating Enterprise Reporting Applications with Crystal Enterprise Part II
Appendix A. Using Sql Queries In Crystal Reports
Creating Enterprise Reporting Applications with Crystal Enterprise Part II