- •Seagate Crystal Web Reports Server Overview
- •What is the Web Reports Server?
- •Who should use the Web Reports Server?
- •Web Reports Server Features
- •New Features in Version 7
- •The Web Reports Server vs. Active Server Pages
- •Sample Web Sites
- •Implementing the Web Reports Server
- •Choosing a Web Reports Server
- •System Requirements
- •Installing the Web Reports Server
- •Confirming Correct Installation
- •Virtual Directories
- •Creating a Web Site
- •For More Information
- •Crystal Web Reports Server Administration
- •The Web Reports Server Configuration Application
- •Page Server Tab
- •Image Server Tab
- •Report Exporting Tab
- •Server Mappings Tab
- •Report Viewing Tab
- •The Page Server and the Image Server
- •Smart Navigation
- •Drilling Down on Data
- •Database Location
- •Web Reports Server Commands
- •The Crystal Web Reports Server Command Expert
- •Constructing Report Requests
- •Changing Selection Formulas in Web Reports
- •SQL and ODBC Data Sources
- •SQL Stored Procedures and Parameter Fields
- •Report Exporting
- •Refreshing Web Report Data
- •Web Reports Server Architecture
- •The Web Reports Server Extension
- •The Seagate Crystal Web Image Server
- •The Seagate Crystal Web Page Server
- •Report Processing
- •Job Manager Overview
- •Seagate Crystal Report Engine Automation Server
- •Visual InterDev Design-time ActiveX Control
- •Using an Existing Report
- •Building a Report at Runtime
- •Editing Active Server Pages
- •Customizing the Crystal Smart Viewer
- •Modifying the Report
- •Session Timeout
- •Sample Web Site
- •Crystal Smart Viewer Overview
- •Features of the Crystal Smart Viewers
- •Printing from the Crystal Smart Viewers
- •Using Crystal Smart Viewers in Applications
- •Crystal Smart Viewer for HTML
- •Limitations of HTML Reports
- •Crystal Smart Viewer for Java
- •Adding the Viewer to a Web Page
- •Crystal Smart Viewer for ActiveX
- •AuthentiCode Certification
- •Adding the Viewer to a Web Page
- •Downloading the Viewer from the Server
- •ActiveX Viewer Example
- •Introduction to the Crystal Report Engine
- •Before using the Crystal Report Engine in your application
- •Using the Crystal Report Engine
- •Crystal Report Engine API
- •Declarations for the Crystal Report Engine API (REAPI)
- •Using the Crystal Report Engine API
- •The Print-Only Link
- •The Custom-Print Link
- •Working with Parameter Values and Ranges
- •Working with section codes
- •Crystal Report Engine API variable length strings
- •Crystal Report Engine API structures
- •Working with subreports
- •Changing report formats
- •Exporting reports
- •PEExportTo Overview
- •PEExportOptions Structure
- •Considerations when using the export functions
- •Handling Preview Window Events
- •Distributing Crystal Report Engine Applications
- •Additional Sources of Information
- •Using the Crystal Report Engine API in Visual Basic
- •When to Open/Close the Crystal Report Engine
- •Embedded Quotes in Visual Basic Calls to the Crystal Report Engine
- •Passing Dates/Date Ranges in Visual Basic using the Crystal Report Engine API Calls
- •Identifying String Issues in Visual Basic Links to the Crystal Report Engine
- •Hard-coded Nulls in Visual Basic User Defined Types
- •Visual Basic Wrapper DLL
- •Crystal ActiveX Controls
- •Adding the ActiveX Control to your Project
- •Using the ActiveX Controls
- •Upgrading from the Crystal Custom Control
- •Crystal Report Engine Automation Server
- •Adding the Automation Server to your Visual Basic Project
- •Using the Automation Server in Visual Basic
- •Object Name Conflicts
- •Viewing the Crystal Report Engine Object Library
- •Handling Preview Window Events
- •Distributing the Automation Server with Visual Basic Applications
- •Sample Applications
- •Active Data Driver
- •Data Definition Files
- •Using the Active Data Driver
- •Creating Data Definition Files
- •Using ActiveX Data Sources at Design Time
- •Crystal Data Object
- •CDO vs. the Crystal Data Source Type Library
- •Using the Crystal Data Object
- •Crystal Data Object Model
- •Crystal Data Source Type Library
- •Creating a new project and class
- •Adding the type library
- •Implementing the functions
- •Passing the CRDataSource object to the Active Data Driver
- •Crystal Data Source Projects
- •Grid Controls and the Crystal Report Engine
- •Bound Report Driver and Bound Report Files
- •Crystal ActiveX Control Properties
- •Creating a Bound Report using the Crystal ActiveX Control
- •Creating a Formatted Bound Report
- •Creating a Formatted Bound Report at Runtime
- •Sample Application
- •ActiveX designers
- •The Report Designer Component vs. Seagate Crystal Reports
- •Data Access
- •No drag and drop between reports – use copy and paste
- •Conditional Formatting
- •Preview Window
- •Pictures
- •Guidelines
- •Subreports
- •The dual formula environment
- •Application Distribution
- •Installing the Report Designer Component
- •System Requirements
- •Installation
- •Using the Seagate Crystal Report Designer Component
- •Adding the Report Designer Component to a Project
- •Selecting Data
- •The Report Expert
- •Adding the Smart Viewer
- •Running the Application
- •CrystalReport1 - The Report Designer Component
- •CRViewer1 - The Smart Viewer Control
- •The Code
- •Report Packages
- •Working with data
- •ADO and OLEDB
- •Connecting to data with ADO
- •Connecting to data with RDO
- •Connecting to data with DAO
- •Data Environments
- •Data Definition Files
- •Report Templates
- •ODBC, SQL, and PC data sources
- •Report Designer Overview
- •Introduction to the Report Designer Component
- •Report Designer Architecture
- •Report Designer Object Model Programming
- •Report Designer Object Model Introduction
- •Obtaining a Report object
- •Displaying the report in the Smart Viewer
- •Setting a new data source for the report
- •Using ReadRecords
- •Passing fields in the correct order
- •Working with secure data in reports
- •Handling the Format event
- •Changing the contents of a Text object
- •Changing OLE object images
- •Working with Sections
- •Working with the ReportObjects collection
- •Working with the FieldObject object
- •Working with the SubreportObject object
- •Working with the Database and DatabaseTables objects
- •Working with the CrossTabObject object
- •Exporting a report
- •The Application object
- •Report events
- •Microsoft Access Sessions
- •Programmatic ID
- •Report Distribution Considerations
- •Distributing reports as part of the application
- •Saving reports as external files
- •Saving data with reports
- •VCL Component Overview
- •Installation
- •Delphi 2
- •Delphi 3 & 4
- •C++ Builder 3
- •Programming Overview
- •Introduction to the Object Inspector
- •Changing Properties in the Object Inspector
- •Changing Properties at Runtime
- •Delphi Programmers introduction to the SCR Print Engine
- •Dealing with SubClass Objects
- •Consistent Code
- •Using the Retrieve method
- •Working with subreports
- •Other Guidelines
- •Programming Tips
- •Always Set ReportName First
- •Discard Saved Data
- •Verify Database
- •Connecting to SQL Servers
- •Changing Tables & Formulas
- •Changing Groups & Summary fields
- •Using the Send methods
- •Using the JobNumber property
- •TCrpeString
- •Introduction
- •TCrpeString VCL Properties
- •Using the TCrpeString
- •Using Variables with Formulas
- •Introduction
- •Examples
- •About Section Names
- •Introduction
- •Methodology
- •StrToSectionCode
- •C++ Builder 3
- •Introduction
- •Code Syntax
- •Additional Code Examples
- •Known Problems
- •Retrieving ParamFields from a Subreport
- •DialogParent and Temporary Forms
- •Technical Support
Connecting to data with DAO
Use the following steps as a guide for connecting to a data source through DAO:
1On the Data Tab of the Create Report Expert, click Project. The Select Data Source dialog box appears.
2Click the DAO option to connect to your data through DAO. The DAO controls are activated.
3From the Database drop-down list, select the database format you want to use for your report. For this example, select Access.
4In the DAO text box, enter the path and file name of the database you want to use, or use the Browse button to locate the database. For this example, select the Xtreme.mdb file. It is located in the Seagate Crystal Reports directory on your system (C:\Program Files\Seagate Software\Crystal Reports by default).
5When the path and file name of the database appear in the DAO text box, click Next in the Select Data Source dialog box. The Select Recordset dialog box appears.
6If the database requires logon information, enter a user name and password in the Logon section of the dialog box.
7In the Recordset section of the dialog box, select either Pick from a list of Database Objects or SQL.
●The Pick from a list option provides a list of object types and objects for each type. For this example, verify that Pick from a list is selected.
●The SQL option allows you to write an SQL query statement.
8From the Object Type drop-down list, select Table to see a list of database tables.
9From the Object drop-down list, select Customer.
10Click Finish in the Select Recordset dialog box. dao appears in the list of Tables on the Data Tab of the Create Report Expert.
Data Environments
Data Environments (introduced with VB 6) allow for interactive creation of ADO Objects at design time, and easy access to data at run time. Through the Data Environment Designer you create Data Environment objects to connect with Data sources (Connection Objects), and access data from those sources (via Command Objects) at design time and run time.
The following steps illustrate how to create and connect to Data Environment objects for Microsoft Access type data sources (.mdb files). This algorithm can be used as a general guide for any data source for which an OLE DB provider exists. Consult the Microsoft documentation for more detailed information on the Data Environment Designer.
Add the Seagate Crystal Report Designer Component and the Data Environment Designer to your project
1Select Components from the project menu.
2In the Components dialog box, click on the Designers tab.
3Click on the Crystal Reports 7 checkbox and the Data Environment checkbox.
The Report Designer Component |
163 |
Create a Data Environment Object
1 Select Add Data Environment from the Project menu. The Data Environment dialog box appears, showing a tree containing the Data Environment icon and two folders labeled Connections and Commands respectively.
2 Double click on the Connections folder. A Connection object icon should appear (if not, right click on the Connections folder and select Add Connection from the menu).
3 Right click on the Connection object icon and select Properties. The Data Link Properties dialog box will appear.
4 Click on the tab labeled Provider. From the list of data providers select an Microsoft Jet 3.51 OLE DB Provider. Click Next.
5Click on the Connection tab. Enter the database name and logon information.
6 Click on the button labeled Test Connection to verify that you have a valid connection to the database. Then click Okay
7 Right click on the folder labeled Commands and select Add Command. The Command object dialog box will appear.
8 Click on the tab marked General. Make sure that the setting marked Connection has the name of the connection object.
9 In the area of the dialog box marked Source of Data click on Database Object and select Table from the pull down list.
10From the pull down list labeled Object Name select Customer.
11Click Apply, then Click Okay
Connect to data with the Data Environment Object
1From the Project menu select Add Crystal Reports 7. The Report Gallery dialog box will appear.
2In the area of the Report Gallery dialog box titled Choose Expert, click on Standard. the Standard Report Expert dialog box will appear.
3 Click on the tab marked Data. In the area of the dialog box marked Data Source click on Data Environment. The Data Environment dialog box will appear.
4Expand the Data Environment object tree. Click on the Command object icon, then click Okay. The name of the command object should appear in the list of tables.
Data Definition Files
Data Definition Files allow you to create reports using the Report Designer Component without specifying an actual data source at design time. Instead, you base your report on a Data Definition file, an ASCII text file with place holders to represent database fields. At runtime, you add code to your application to specify the actual source of data for the report. The data source applied to the report at runtime can be created through
The Report Designer Component |
164 |
Data Access Objects (DAO), Remote Data Objects (RDO), or ActiveX Data Objects (ADO).
A report designed with a Data Definition File contains information about the kind of data to place in the report instead of information about an actual data source. It looks for field types, rather than actual fields. These field types are specified in the Data Definition File. For example, the following is an example of the contents of a Data Definition file that could be replaced at runtime by the Orders table in the Xtreme database:
Order ID |
|
long |
1 |
Order Amount |
currency |
1.00 |
|
Customer |
ID |
long |
1 |
Employee |
ID |
long |
1 |
Order Date |
date |
Jan 5, 1994 |
|
Required Date |
date |
Jan 5, 1994 |
|
Ship Date |
|
date |
Jan 5, 1994 |
Ship Via |
|
string 20 |
string sample value |
Shipped |
|
boolean |
TRUE |
PO# |
|
string 50 |
string sample value |
Payment Received |
boolean |
TRUE |
As you can see, the Data Definition File is a simple ASCII text file with fields listed on separate lines. Each field in the text file represents a field that must exist in the true ADO, RDO, or DAO data source that replaces the Data Definition file at runtime. At design time, you create your report based on the Data Definition file. The three columns of the file provide the name of the fields, the data type for the fields, and a sample value. String fields, as you can see, also require a value for the length of the string. The values in the sample value column are optional and will only be used if you neglect to replace the Data Definition file with a true data source.
At runtime, you change the data source pointed at by the report using the SetDataSource method. The new data source can be a Recordset or Resultset object produced using DAO, RDO, ADO, or through the Visual Basic Data Control. Once the Report Designer Component obtains the Recordset or Resultset object from the runtime data source, it can produce and display the final report using actual data. The process saves you the time of creating a complete data source prior to designing the report and your application.
Passing fields in the correct order
When defining a Recordset or Resultset object to pass to your report at runtime, you must pay attention to the order in which the fields are added to the recordset. Fields must appear in the recordset in the same order in which they appear in the Data Definition file. In addition, all fields that appear in a Data Definition file must be included in the recordset, whether or not they are actually used in the report. For more information, see
Passing fields in the correct order, Page 177.
The Report Designer Component |
165 |
Creating a Data Definition File
The Report Designer Component provides the Database Definition Tool, a built in tool for designing and producing Data Definition Files. The following steps explain how to design a Data Definition File. From the Data Tab of the Create Report Expert:
1Click the Project button. The Select Data Source dialog box appears.
2Click the Data Definition option to create a report based on a Data Definition File.
3Click the New button next to the Data Definition text box. The Database Definition Tool appears.
4Use the Database Definition Tool to create fields for your Data Definition File. Use the controls to enter a field name, field type, and sample data. If you select String as the field type, you will also be asked to specify a maximum string length.
5Click Add to add each new field to your file. The new field will appear in the list at the bottom of the Database Definition Tool.
6Continue adding as many fields as necessary for your Data Definition File by entering the information in the controls of the Database Definition Tool, and clicking Add each time.
7You can delete a field that you have created by selecting the field in the list box and clicking Delete.
8Click the Close button in the right corner of the title bar when you are finished designing your Data Definition File. You will be prompted to save the new file.
9Click Yes, and the Save File As dialog box appears. Save the file in a convenient directory for your Visual Basic application. The resulting path and file name appear in the Data Definition text box of the Select Data Source dialog box.
10Click Finish. The name of the Data Definition File appears in the Tables list of the Data Tab in the Create Report Expert.
11Continue designing your report using the Create Report Expert and the Report Designer Component.
Obtaining a Recordset from the Runtime Data Source
Once you have created the Data Definition File and designed a report based on that file, you can begin programming your application to obtain a Recordset or Resultset object from a runtime data source. This data source can be opened through DAO, RDO, ADO, or the Visual Basic Data Control. The following tutorial briefly demonstrates how you can obtain a simple ADO Recordset object.
1Declare an instance of the ADO Recordset object in your Visual Basic application. This can be handled in the declarations section of a form or module.
Dim rs As New ADODB.Recordset
2Obtain a set of records from an ODBC data source.
rs.Open “SELECT * FROM Customer”, “DSN=Xtreme sample data;”, adOpenKeyset
The Report Designer Component |
166 |