- •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
Component |
Description |
|
|
|
|
Data Set |
One of the following: |
|
● Data Access Object (DAO) Recordset |
|
● Remote Data Object (RDO) Resultset |
|
● Active Data Object (ADO) Recordset |
|
● VB Data Environment |
|
● Crystal Data Object (CDO) |
|
● Crystal Data Source Type Library object |
|
● ODBC Direct |
|
● Crystal Data Source Type Library object |
|
These objects do not need to be valid at design time, for example you |
|
could construct a report template at design time without the data being |
|
available. This is handled through a Data Definition Files, Page 164. |
|
However, the data set objects must be present and valid at runtime to |
|
generate a report. |
|
|
VB Form |
The Seagate Crystal Reports Smart Viewer Control must be embedded on |
|
a Visual Basic Form in order to display the report on screen. The Create |
|
Report Expert can automatically add a Form with the Smart Viewer |
|
embedded to the project when you finish designing a report with the |
|
Expert. |
|
|
Dual - Interface
The object model for the Report Designer Component is exposed as a dual-interface. This means the component can be accessed and utilized easily in all kinds of development environments including Visual Basic, Visual InterDev, Visual C++, and Delphi. Although the component may not work as an ActiveX designer in all environments, the object model can be used as an automation server or ActiveX DLL in any development environment that supports ActiveX.
Report Designer Object Model Programming
The Seagate Crystal Report Designer Component provides a strong yet accessible object model for manipulating reports within your Visual Basic application. Through the object model, you can leverage the full power of Visual Basic to control the final look and content of your data.
Though easy to use, the object model requires knowing several basic techniques and strategies. This section provides examples of how to work directly with the object model to accomplish specific types of tasks. If you need information on report design using the Report Designer Component, refer to the Seagate Crystal Reports User’s Guide. Designing reports in the Report Designer Component is very similar to designing reports in the Report Designer for Seagate Crystal Reports.
The Report Designer Component |
173 |
The tutorials in this section concentrate on the objects, properties, methods, and events of the object model exposed by the Report Designer Component. If you need to learn some general programming techniques that can be applied to all types of reports, review the topics listed below. The tutorials listed here do not assume that you are trying to create a specific type of report. Instead, they discuss the object model from a programming point of view, regardless of the report that you are trying to create.
The following topics are discussed in this section:
Report Designer Object Model Introduction, Page 175
Obtaining a Report object, Page 175
Displaying the report in the Smart Viewer, Page 175
Setting a new data source for the report, Page 176
Using ReadRecords, Page 177
Passing fields in the correct order, Page 177
Working with secure data in reports, Page 179
Handling the Format event, Page 179
...including comments regarding Calculating Results, Page 180 Changing the contents of a Text object, Page 180
Changing OLE object images, Page 182
Working with Sections, Page 182
Working with the ReportObjects collection, Page 183
Working with the FieldObject object, Page 184
Working with the SubreportObject object, Page 185
Working with the Database and DatabaseTables objects, Page 186
Working with the CrossTabObject object, Page 186
Exporting a report, Page 187
The Application object, Page 187
Report events, Page 188
Microsoft Access Sessions, Page 189
Programmatic ID, Page 189
Distributing reports as part of the application, Page 190
Saving reports as external files, Page 190
Saving data with reports, Page 191
The Report Designer Component |
174 |
Report Designer Object Model Introduction
The Seagate Crystal Report Designer Object Model has been optimized for easy access to reports created using the Report Designer Component and the objects within those reports. Rather than forcing you to navigate through a complex hierarchy of collections and objects to get at a single report element, the Report Designer Object Model presents a flatter hierarchy that requires only obtaining, at most, a couple layers of objects to get at any report element. This hierarchy begins with the Report object.
Obtaining a Report object
Many existing ActiveX object models require declaring and creating a high level object, such as an Application object, before you can work directly with the data. The Report Designer Component, however, allows direct access to the Report object, giving you control over your reports with a small amount of Visual Basic code.
Assuming you have added the Report Designer Component to a Visual Basic application, and the (Name) property of that component is set to CrystalReport1, the following code demonstrates how to obtain a Report object representing that component:
Dim cr As CRAXDRT.Report
Set cr = New CrystalReport1
The first line declares cr as Report object from the CRAXDRT object library, the Report Designer Component’s object library. The second line of code defines cr as a new instance of the report in the CrystalReport1 component in your application.
Displaying the report in the Smart Viewer
Obtaining a Report object allows you to manipulate the report at runtime. Of course, once you make changes to the report, you will frequently want to display it through the Smart Viewer. The Smart Viewer is an ActiveX control that actually sits inside a Visual Basic form. Assuming you have added the Smart Viewer to a form named frmViewer, and the Smart Viewer control is named CRViewer1, the following code displays the report.
frmViewer.CRViewer1.ReportSource = cr
frmViewer.CRViewer1.ViewReport
frmViewer.CRViewer1.Visible = True
This code can be added to the Load event of the frmViewer form. When the form loads, the report is displayed.
After looking over the previous sections on obtaining a Report object and displaying the report in the Smart Viewer, you will quickly see how little code is required to perform the basic operations of displaying a report on screen. The Report Designer object model is designed to simplify your code and reduce project development time.
The Report Designer Component |
175 |
Setting a new data source for the report
One of the most common tasks with the Report Designer Component is to specify a different data source at runtime from the one used to design the report. For example, you may want to provide a report containing a default set of data, then allow your users to customize the results by making selections in your application. At runtime, you create a new set of data based on the user’s choices, then use that new data source to replace the default data in the report.
Data Definition Files allow you to design the report at runtime without even specifying an actual data source. For instance, your data source may be highly dynamic, or it may even be nonexistent until runtime. You can design the report based on the Data Definition file, then create your data source at runtime and hand it off to the report before printing.
The following code creates a new ADO Recordset object, assigns the new recordset to the report, then assigns the report to the Smart Viewer control for display on screen.
Private Sub Form_Load()
Dim Report As New CrystalReport1
Dim rs As New ADOR.Recordset
rs.Open "SELECT * from Customer WHERE country = 'USA'", _ "DSN=Xtreme sample data;", adOpenKeyset
Report.Database.SetDataSource rs
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
End Sub
Notice that this code is handled in the Load event of a Form. This would normally be the form that contains the Smart Viewer ActiveX control. Handling this process during the load event of the Smart Viewer form is the quickest and easiest means of assigning new data to the report.
In the first line of code, a new Report variable is defined as an instance of the Report Designer Component that has been added to the Visual Basic project. Immediately after that, a new ADO Recordset object is defined. The Recordset object is then assigned a set of data (a recordset) using a SQL query statement. In this example, the statement is hard-coded into the application. However, you could easily design an application that dynamically generates a query statement based on a user’s input or selections.
Next, the SetDataSource method of the Report Designer Component’s Database object is used to specify that the new ADO Recordset should be used to generate the report. SetDataSource accepts a single argument: the Recordset object itself. This argument could also be a DAO Recordset or an RDO Resultset, or any other ActiveX data source, as described in Active Data Driver, Page 118. The only restriction on the data source assigned using SetDataSource is that it contain fields that match the fields used to originally create the report. For instance, if the report was created using three string fields named SSN, LastName, and FirstName, the new data source must also consist of three string fields named SSN, LastName, and FirstName.
The last two lines of code in this example assign the report object containing the new data source to the Smart Viewer ActiveX control that appears in the Form, and displays the report. When the Form is loaded by your Visual Basic application, the report will be displayed with the new data from the ADO Recordset.
The Report Designer Component |
176 |