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 selecting the data source for 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 1.6. The Data Explorer is a tree control hosted inside the Report Wizard that enables you to identify the following:

  • Which Crystal Reports database driver you want to use
  • Which data source you want you use
  • Which database objects you want to use

Figure 1.6. The Data Explorer provides access to the multitude of supported Crystal Report's data sources.

graphics/01fig06.jpg

To open 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 a number of categories. The following sections describe each of these categories, whereas Crystal Repository is discussed in Chapter 18.

Creating a New Connection

To specify a new connection, expand the Create New Connection node in the Data Explorer. As Figure 1.6 shows, you can select from a multitude of data sources in this interface. You will notice a node in this section for each of the drivers selected during the installation process.

NOTE

One node to take special note of is the More Data Sources node. When this is expanded, it lists all database drivers that are available but not installed. Crystal Reports supports install on-demand. This means that various features always appear as being available, even if they are not installed. When you expand one of the database driver's node selections under the More Data Sources node, that driver would be installed on-demand. Then the next time the Data Explorer is loaded, it would list that driver directly under the Create New Connection node.

Now that you understand which data sources are listed where, look at the process of creating a connection. To create a connection, follow these steps:

  1. 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 10. To create a connection to this database, expand the ODBC (RDO) node.
     
  2. 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 10 should be visible. This is pre-installed with Crystal Reports. Select this and click Finish.
     
  3. Focus returns 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.

Using 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 is listed under the Current Connections node. The first time the Crystal Reports designer is opened, the Current Connection node is empty because no connections have been initiated. This is 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.

Using Favorite Connections

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 makes 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 1.7 illustrates the Xtreme Sample Database connection being added to a user's Favorites.

Figure 1.7. Add the Xtreme Sample Database ODBC connection to the Favorites node to locate it quickly.

graphics/01fig07.jpg

 

Leveraging Recently Used Connections with the History Node

The History node is situated beneath the Favorites node in the Data Explorer. 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 stores 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.





Special Edition Using Crystal Reports 10
Special Edition Using Crystal Reports 10
ISBN: 0789731134
EAN: 2147483647
Year: 2003
Pages: 341
Simiral book on Amazon

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