How Crystal Reports Works


Users of a DBMS typically perform the following four actions:

  • Delete

  • Retrieve

  • Add

  • Update

A day in the life of a DBMS user might consist of deleting records no longer in use, retrieving data to view, adding records to a system, and perhaps editing some incorrect data.

Crystal Reports allows users only one of these four functionality options: the ability to retrieve data. In no way whatsoever can you or your report users add, update, or delete database information using Crystal Reports. This concept is so important, it deserves to be repeated:

In no way can one alter their data with Crystal Reports.

This is a good thing. It means that you can make all the mistakes you want with Crystal Reports and not worry about blowing up any of your company's data.

Crystal Reports allows you to retrieve information from your database without having to write SQL statements (a command language) in order to view and format your database information. Not only does Crystal Reports make retrieving data easier, but it also enables users to format output data in a pleasing and meaningful manner.

How Crystal Reports works with a database is illustrated in Figure 1-4.

click to expand
Figure 1-4: How Crystal Reports works with a database

Note

A request to retrieve information from a database is commonly known as a query. The set of rules for constructing queries is known as a query language.

Different DBMSs support different query languages; however, nearly all DBMSs support a semi-standard query language known as SQL (Structured Query Language) in some fashion. We learn more about the SQL language in Chapter 15, "Exploring Crystal Reports' SQL Commands."

The Report Processing Model

So how does Crystal Reports work?

First, a report writer designs a report prototype, including a connection to the database and the tables and fields to be used within the report. The report writer then works at formatting the report, controlling how the data should display. Once ready, the user previews the report.

When a report is previewed, Crystal Reports begins to retrieve the data in the fashion defined by the report writer. Crystal Reports' retrieval process is known as the Report Processing Model and consists of one to three passes against a database. A pass is a process that occurs when data is read or manipulated.

The number of passes that Crystal Reports performs depends on the complexity of the report or formulas used. A simple report needs to make only one pass, whereas a report filled with several complex calculations would perform all three passes.

Figure 1-5 displays Crystal Reports' Report Processing Model.

click to expand
Figure 1-5: The Report Processing Model

Note

Passes occur on the server where the database resides. This activity performed at the server is better known as server-side processing. Servers typically provide a much quicker response time than a client.

Crystal Reports utilizes server-side processing, which results in the faster generation of your reports.

The following summarizes the different passes of the Report Processing Model:

  • Pre-Pass 1: Before your report even passes to the database, Crystal Reports evaluates formulas that do not require data (such as arithmetic statements). The Pre-Pass 1 pass is also referred to as BeforeReadingRecords.

  • Pass 1: After the formulas from Pre-Pass 1 have been evaluated, Crystal Reports begins accessing the database. This process is also referred to as WhileReadingRecords.

  • Pre-Pass 2: For simpler reports, only Pre-Pass 1 and Pass 1 are required. However, for more complex reports, Crystal Reports now begins performing more involved groupings of data.

  • Pass 2: With this pass, Crystal Reports performs a second pass at the database, evaluating data to meet more formatting information. This process is also referred to as WhilePrintingRecords.

  • Pass 3: In Pass 3, the total page count of the report is determined.

You won't need to worry about how Crystal Reports obtains its data; Crystal Reports performs these passes unbeknownst to you. However, it's never a bad idea to understand what's happening under Crystal Reports' hood — especially since you begin driving Crystal Reports in the next chapter.




Mastering Business Analysis with Crystal Reports 9
Mastering Business Analysis with Crystal Reports 9 (Wordware Applications Library)
ISBN: 1556222939
EAN: 2147483647
Year: 2004
Pages: 177
Authors: Chris Tull

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net