ObjectStore Active Toolkit Tutorial
Chapter 5
Using Crystal Reports with ATK
Introduction
Reporting functionality is a typical application requirement, but most commonly used reporting tools are designed to run against relational databases. ATK, however, lets you easily build tabular views of the data in an ObjectStore database using most common report generating tools, including Crystal Reports.
Crystal Reports, and other ODBC consumer applications, can access ATK's OLE DB interface through ISG Navigator. This capability enables you to add reporting functionality to your ObjectStore application.
Software resources
To complete this tutorial, you need the following software resources:
In this chapter
In this chapter, you create a data view that you can use with any reporting tool. Then, you use Crystal Reports to create a report. This chapter contains these sample exercises:
Create a Data View for the Report
Process
Specify the data that is available for the report. To do so, follow these steps:
Create a new data view.
Customize the data view.
Save the data view.
1 Create a new data view.
Start Inspector.
Open the carsdemo.db database.
Double-click on the vehicle root in the Database Roots pane.
Select Data View | Create.
This data view displays a collection of vehicles:
2 Customize the data view.
Modify the Vehicle class instance format to display owner information for each vehicle.
Right-click anywhere in the data view.
Select Set Format of Class.
Expand the owner relationship.
On the Instance Format sheet of the Instance Format dialog box, double-click on the name and address data members in the Customer class.
Click OK.
For each vehicle, Inspector traverses pointers to display the owner name and address in the new instance format:
3 Save the data view.
Select File | Save.
Name the data view VEHICLES.
Select File | Save All.
Create a Report Using Crystal Reports
Overview
Using the ObjectStore Active Toolkit OLE DB provider and ISG Navigator, you can access an ObjectStore database from any ODBC consumer application.
Process
To do this, follow these steps:
Start the Report Wizard.
Create the report.
Group the report data by year.
Preview the report.
1 Start the Report Wizard.
Start Crystal Reports.
Select File | New.
The Create New Report dialog box appears.
Click Standard to start the Crystal Reports wizard.
Click SQL/ODBC.
The Create Report Expert dialog box appears:
Click the SQL/ODBC tool.
From the list of available data sources, choose
ODBC-ODIATKDEMO.
Select the VEHICLES data view, which you defined in Inspector.
If the data view is not listed, verify that Inspector is saving its metaknowledge in the same place from which ATK is loading it. Refer to Chapter 4, Configuring ATK, in the ObjectStore Active Toolkit Reference.
Click Add.
Click Done.
2 Create the report.
Follow the directions of the Crystal Report wizard to create the report.
On the Create Report Expert dialog box, click the 2: Fields tab.
To include all the columns defined in the VEHICLES data view, click the All->> button.
Including all columns of the VEHICLES data view requires that data members from two different classes be included.
3 Group the report data by year.
Click the 3: Sort tab.
Select VEHICLES.year from the Report Fields pane.
Click Add. VEHICLES.year appears in the Group Fields pane.
4 Preview the report.
Preview the report by clicking the Preview Report button on the
3: Sort sheet of the Create Report Expert dialog box.
Now that you have created the report, you can modify it using Crystal Reports features.
Summary
In this chapter, you created a data view that makes particular data items available for querying. Then you used the Crystal Reports wizard to create a report that queries an ODBC data source and displays the data items that you specify.
Generating reports based on data views that you build with Inspector and access through ATK is a straightforward process. By using data views, you can generate reports for any ObjectStore database.
[previous]
Copyright © 1998 Object Design, Inc. All rights
reserved.
Updated: 05/11/99 12:01:06