Viewing Reports

Naturally, simply printing out a list of reports isn all that useful if they can be viewed. This section focuses on viewing reports. Report viewing is also done via the Crystal Enterprise SDK, specifically, through an object called the CrystalReportViewer. This viewer object, like the other SDK objects, resides on the server. Its job is to render reports to a paginated HTML output. Generally, an ASP page is created and this page is passed in some kind of identifier to determine which report to display (see Listing 34.14).

Listing 34.14. Viewing a Report in HTML



Set sessMgr = Server.CreateObject("CrystalEnterprise.SessionMgr")

Set sess = sessMgr.Logon("Ryan", "123", "CMS1", "secEnterprise")

 Get the name of the report from the query string

reportID = Request.QueryString("reportID")

 Retrieve the report source object given the ID

Set reportSource = sess.Service("", "PSReportFactory").OpenReportSource(reportID)

 Create and set up the viewer object

Set viewer = CreateObject("CrystalReports.CrystalReportViewer")

viewer.EnterpriseLogon = sess

viewer.ReportSource = reportSource

 Instruct the viewer to render the HTML output into the response stream

viewer.ProcessHttpRequest Request, Response


The first part of Listing 34.13 establishes a session to Crystal Enterprise. The second part then extracts the reportID item off the query string and stores it in the reportID variable. Next, like the InfoStore, the PSReportFactory is retrieved via the EnterpriseSession object. The PSReportFactory (or Page Server Report Factory) is an object that represents the Page Server service. It has an OpenReportSource method that takes the report ID as an argument. When this method is invoked, the page server opens the report and loads it ready for processing. Next, the CrystalReportViewer object is created and two things are passed into it: the active Crystal Enterprise session, and the reportSource object, which represents the report the page server has open. Finally, the ProcessHttpRequest method of the viewer object is called, which instructs the Page Server to execute the first page of the report and return its output. The viewer then converts that output into HTML and writes that into the pages response stream. The end result is a page with the first page of the report displayed. Figure 34.2 shows the output of one of the sample reports.

Figure 34.2. The output of Listing 34.14 shows a report displayed in HTML.



When querying the InfoStore for a given report by name, if you want only report objects and not report instances, include the WHERE SI_INSTANCE=0 condition in the query. This tells the InfoStore to only bring back reports that are not instances. Remember, the report keeps the same name when its scheduled.

Because the report output can be written anywhere into the response stream, many possibilities of report presentation are available. Sometimes the only content on an ASP page is a report, other times it can be residing along with page headers, footers, navigation panels, or other images and text.

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

Special Edition Using Crystal Reports 10
Special Edition Using Crystal Reports 10
ISBN: 0789731134
EAN: 2147483647
Year: 2003
Pages: 341 © 2008-2020.
If you may any questions please contact us: