Selecting Your Reporting Database


Before creating any report, you'll need to select a data source. For the examples in this book, you'll use the sample xtreme.mdb data-base provided with Crystal Reports. Go ahead and connect to this database (as you did in the last chapter). You should see your connection display in the Database Expert dialog box.

Note

As mentioned in the last chapter, Crystal Reports allows you to connect to the same database using different methods. Check with your system administrator for your company's preferred method of database connection.

Selecting Database Tables for Your Report

Once you've connected to the xtreme.mdb file, click on the data-base's node. Notice that the database contains the following three nodes: Tables, Views, and Stored Procedures, as shown in Figure 3-1. These nodes represent the database's data structures.

click to expand
Figure 3-1: Viewing the data structures of your database

You learned about tables in Chapter 1. For most of your reporting needs, you'll find yourself working with tables more than any other database structure. However, it never hurts to familiarize yourself with these other database options available for reporting:

  • Views: Views are tables created by grabbing certain fields from a number of tables and making them visible all within one table. Views can be useful in reporting. Rather than grabbing and linking multiple tables for a report (explored in Chapter 6), a single view might contain the only the needed information from multiple tables. Views are written in SQL and are typically created by a database administrator or other individual who has rights to manipulate the physical structure (not just the data) of a database.

  • Stored procedures: Stored procedures are operations stored within the database server that are often used in the place of embedded SQL queries (written in the graphical user interface code). Stored procedures are developed by database developers/administrators to ease the management and display of information about that database (and its users). For the most part, you won't utilize many stored procedures within your reports.

For now, double-click the Tables node. You'll notice a list of tables display, as shown in Figure 3-2.

click to expand
Figure 3-2: The Tables node displays all tables within a database.

Once you've successfully connected to your database, you can choose one or more database tables you wish to include within your report. To add a table to your report, perform the following steps:

  1. Select the table you wish to include within your report.

    For this report, select the Customer table.

  2. Press the Add button (>).

    You'll see the Customer table move to the Selected Tables list box.

  3. Press the OK button.

    The Database Expert dialog box closes, and the Report Design area displays.

If you choose more than one table, you'll see a linking screen display. Using two or more tables within a report requires successfully linking the two tables together. Linking multiple tables is covered in Chapter 6.

Tip

You don't have to select all tables needed within a report right away. Once in the Report Design area, you can always access the Database Expert again and add tables as needed. To access the Database Expert within the Report Design area, select Database, Database Expert from the menu bar.




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