Introduction to the Data Explorer

Now that you've got a basic understanding of what database drivers are and an idea of which one you might use to access a particular data source, let's look at the user interface for specifying the data source of a report. Because this is the first step in the creation of a report, it is only natural that this is the first step in the Report Wizard. This is shown in Figure 3.2. The Data Explorer is a tree control hosted inside the Report Wizard that allows the report developer to identify the following things:

  • Which Crystal Reports database driver you want to use

  • Which data source you want you use

  • Which database objects you want to use

Figure 3.2. The Data Explorer.

graphics/03fig02.jpg

To bring up the Data Explorer, select File, New and click OK to create a new report using the Report Wizard. The Data Explorer represents data source connections organized into the following categories: Current Connections, Repository, Favorites, History, and Create New Connection. The following sections describe each of these categories, with the exception of the repository, which will be discussed later in the hour.

Create New Connection

To specify a new connection, expand the Create New Connection node in the Data Explorer. The following data sources correspond to the database drivers installed on the system. By default, the following drivers are preinstalled:

  • Access/Excel (DAO)

  • Crystal Queries

  • Dictionary/Infoview

  • ODBC (RDO)

  • OLAP

  • OLE DB (ADO)

If during the installation of Crystal Reports, a typical install was selected, you will notice a node for each of these drivers. There are also two additional nodes: Database Files and More Data Sources.

The Database Files node doesn't represent a specific database driver, but rather, when expanded, will allow you to select a variety of database files such as Access (.mdb), XML (.xml), and Universal Data Link files (.udl). This is simply a shortcut. Selecting an Access MDB file via the Database Files node is functionally equivalent to selecting it under the Access/Excel (DAO) node.

The other node of interest is More Data Sources. When this is expanded, it will list all database drivers that are available but not installed.

graphics/bookpencil_icon.gif

Crystal Reports 9 supports install on-demand. This means that various features will always appear as being available, even if they are not installed. When an advertised feature is selected, it will be installed and become available for use immediately.


When you expand one of the database drivers' nodes selections under the More Data Sources node, that driver would be installed on-demand. After this is done, the next time the Data Explorer is loaded, it would list that driver directly under the Create New Connection node.

Now that you understand what data sources are listed where, let's look at the process of creating a connection:

  1. To create a connection, expand the node that corresponds to the appropriate database driver. An easy one to play with is the Xtreme sample database that comes with Crystal Reports 9. To create a connection to this database, expand the ODBC (RDO) node.

  2. You will notice that when a node is expanded, a dialog is presented that allows for the specification of connection information. In the case of ODBC, the DSN is the only thing required. In this list of available DSNs, Xtreme Sample Database 9 should be visible. This is pre-installed with Crystal Reports. Select this and click Finish.

  3. Focus will return to the Data Explorer, and there should be a node below the ODBC (RDO) node called Xtreme Sample Database. Below that node is the list of available tables and views, as well as the Add Command option for adding a SQL command. (This will be discussed shortly.)

The Xtreme Sample Database could also have been used via the OLE DB or direct Access driver. Note that when prompted for connection information when using one of these drivers, the report developer is asked to provide different information. In the case of ODBC, a DSN needed to be selected; whereas with OLE DB, a provider would need to be specified.

Current Connections

The Current Connection node lists all database connections that are currently open. In other words, if a report is currently open or was recently open, that connection will be listed under the Current Connections node. The first time the Crystal Reports designer is opened, the Current Connection node will be empty because no connections have been initiated. This will be indicated by a "…no items found…" item shown when the Current Connections node is expanded. This is a quick way to select the same connection as another report currently open.

Favorites

The Favorites node lists all connections that have been designated a favorite. This is analogous to favorites and bookmarks in a Web browser. If you have a certain database connection that is used often, adding it to the favorites will make it quick and easy to find in the future.

To accomplish this, create a connection to a database (you can use the Xtreme Sample Database to try this out), and select Add to Favorites when right-clicking on that connection. Be sure to right-click on the connection and not the driver or table name. Figure 3.3 illustrates the Xtreme Sample Database connection being added to a user's favorites.

Figure 3.3. Adding the Xtreme Sample Database ODBC connection to the favorites.

graphics/03fig03.jpg

History

Under the Favorites selection in the Data Explorer is the History node. It lists recent database connections that have been made. This is useful for quickly locating and using a connection that has been recently used, but not added to the Favorites list. The history list will store the last few connections. If you find yourself using connections from the History node frequently, it might be better to add the connection to your favorites list.



Sams Teach Yourself Crystal Reports 9 in 24 Hours
Sams Teach Yourself Crystal Reports 9 in 24 Hours
ISBN: B003D7JUVW
EAN: N/A
Year: 2005
Pages: 230

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