Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

10.03 Common Data Sources

There are too many types to cover in this chapter, but let’s review some of the more common ones listed in Table 10-1.

Table 10-1. Common Data Sources

Data Source Description
Acccess/Excel/ Database Files Select a PC database/Excel file using its file location.
ODBC (RDO) Connect using an ODBC driver by selecting an existing System DSN.
OLE DB (ADO) Builds a connection string to access data sources using an OLE DB driver. It asks you for the data source to connect to and any relevant information regarding its location and logon information.
XML XML is a generic file format for describing data. It continues to increase in popularity as more companies realize how easy it is to share information using XML. You can even report from data off of another company’s web server if they have a public web services URL (Amazon.com does this for reporting their book’s sales rankings).
Field Definitions Only Found within the More Data Sources folder, it specifies a field definition file with a .ttx extension. This is only for backwards compatibility and isn’t used for new development.

To select the data source from the Database Expert dialog, click on the proper folder node to expand it. This triggers a dialog box which asks for information about the data source. The dialog is specific to the type of data source being opened because each data source has different requirements to open the data source. For example, opening an Excel file will prompt you for a file path and filename, but opening a SQL Server database will prompt you for the server name and authorization credentials. Upon entering the information, the dialog box closes and the data source name is shown in the Database Expert and listed under its folder. Under the data source name is the list of available tables, views and stored procedures. Click on the plus signs next to the individual items to expand the list.

There is one small quirk about the Available Data Sources window you should be aware of. It occurs when you click on the plus sign to expand a folder and a data source dialog box opens up. If you accidentally close the dialog box without adding a new data source, there is no option to open the dialog box again. You have to click on the minus sign to close the folder and then click on the plus sign to expand it again. This triggers the dialog box to open a second time. Once you’ve added a data source to that folder, this isn’t an issue because there will now be an item listed as the first item and clicking on it lets you add another data source.

Add the tables you need by selecting them and clicking on the right arrow button. Double-clicking on the table adds it to the list as well. When all the necessary tables have been added, go to the Links tab to establish the relationship between the tables.

Adding Common Data Sources

Let’s look at the steps involved for connecting to common data sources and adding tables from each one. We’ll see that although there are many similarities between them, each is unique in its own way.