Deploying the Crystal Report

book list add book to my bookshelf create a bookmark purchase this book online

mastering crystal reports 9
Chapter 16 - Deploying Your Report
Mastering Crystal Reports 9
by Cate McCoy and Gord Maric
Sybex 2003

When you save a Crystal Report, you save it in an RPT file. This file is your complete report; it contains everything you used to create this report. An easy deployment technique is simply to provide your customers with the RPT file. You can e-mail this file to them as an attachment, and they can copy the file to their hard drive. The pros and cons of this deployment method are shown below:

Pros

Cons

Easy to deploy.

User requires a licensed version of Crystal Reports to open the report.

Deploys to a shared networked drive for easy access.

Requires connectivity set up on the user’s computer so they can access the shared drive.

Users can change the report.

Users can change the report.

Developer can send report via e-mail as an attachment.

User requires a database ID and password to the database.

User can refresh report to gain access to most current data.

 

Warning 

Keep in mind that when you deploy the RPT file to the end user, their computer must have the same database connectivity set up as the report developer’s computer before the user will be able to refresh the report.

Deploying the Report without Saved Data

The RPT file without saved data is small enough that it can be e-mailed to the end user or placed on a shared network drive for the user to access. As a report developer, you can do the sophisticated report development and the user can make any minor changes they may need.

Warning 

If you are placing a report on a shared network drive for multiple users, you can run into trouble with users making changes to the shared copy. It is best for the users to copy the report to their computer and open it from there.

To save a report without data, click the File menu, deselect Save Data With Report, and save the report. This will not save the data for this report.

Alternatively, you can create a global setting so that all reports by default have no data by choosing the File > Options > Reporting and deselecting Save Data With Report.

Deploying the Report with Saved Data

Deploying the report with data is useful when having the latest data is not necessary. Saving data in a report and distributing it to multiple users also minimizes the number of hits on the database server.

Reports with saved data can be large files. Before deploying the report, decide on the best way to send a large file in your organization.

To save a report with data, choose File > Save Data With Report and save the report. This will include the data in the report.

Alternatively, you can create a global setting so that all reports by default save the data by choosing File > Options > Reporting and selecting Save Data With Report.

Report Bursting Indexes

Report Bursting Indexes are a new feature in Crystal Reports 9.When a report is saved with data, the data in the report is just a blob of data. When the report viewer requests a particular field from the report, the Crystal reporting engine must search all the stored data to find the required information. It is like searching for a particular reference in a book without a table of contents.

Report Bursting Indexes act like a table of contents in a book; they help the Crystal Report engine find the data you are looking for more quickly.

Once you create Report Bursting Indexes, they are completely transparent to the end user viewing the report. They make navigating through the report faster, but the end user does not know the indexes are being used.

Consider using Report Bursting Indexes on large reports with saved data.

Creating Report Bursting Indexes

To create a Report Bursting Index, choose Report > Report Bursting Indexes. The Saved Data Indexes dialog will appear, as shown in Figure 16.1. The Available Fields list contains a list of fields on the report. Move fields that are commonly referred to in the report’s record-selection formulas or record selection into the Indexed For Bursting list, by highlighting the field and clicking the arrow button.

click to expand
Figure 16.1. Creating Report Bursting Indexes

You can click the Auto button to automatically add fields that are used in the record-selection formulas. When the report is refreshed, the indexes will be built.

Warning 

You may think that it would be advantageous to index all the fields in the report. Do not do this, as it will increase the size of the report and will actually slow the retrieval.

Switching Data Sources

Reports are often created on a sample database or test database. When it is time to deploy your report to the end users, you must switch the data source to the production data. Choose Database > Set Datasource Location. The Set Datasource Location dialog will appear, as shown in Figure 16.2.

click to expand
Figure 16.2. Switching databases

The top window displays the current connection to the database. The bottom window allows you to select the alternative data source. You establish a connection to the alternative data source in the bottom window.

You can switch tables individually or switch the entire database. If your report contains tables from only one database, in the top window select the current database, and in the bottom window select the database you want to switch to. Then click the Update button.

If your report contains tables from various databases, select the tables individually and then click the Update button.

If the two databases contain the same structure, your report is now pointing to the same new data source.

Tip 

When we develop reports, we like to make a copy of the client’s database in Microsoft Access. Then we do all our report development in Access, and then back at the customer’s office we switch databases to move the reports to production.

When switching data sources, remember that you are changing the underlying program (data access DLL, or Dynamically Linked Library) that queries the data source. It is important to verify the data in your report after making the switch. When Crystal Reports is reporting from a data source that it can read directly, it is processing the retrieval of records. However, when Crystal is reporting through a driver, such as ODBC or OLEDB (Object Linking and Embedding for Databases, a special DLL fordatabase connectivity), it is passing a SQL statement to the driver, telling the driver what it wants. This difference can lead to inconsistencies in how tables are joined and queries are resolved and what data is displayed in your report.

The problem can be resolved by changing the order in which the tables are joined or changing the join from an equal join to a left or right outer join. Choose Database > Database Expert and click the Links tab to show the linking information for the report. The Database Expert dialog will appear, as shown in Figure 16.3. Select the links between the tables, and then click the Link Options button to change the linking information. This step is not always necessary, but if you do run into problems, this can help.

click to expand
Figure 16.3. Link Options

Tip 

To avoid the linking issues, create an OLEDB connection to Access. That way, Crystal Reports is always passing a SQL statement to the database and not directly processing the record. This avoids potential differences in how data is accessed.

Mapping Database Fields

If the two data sources are not the same, then the Map Fields dialog will be displayed, as shown in Figure 16.4. Notice that the Report Fields list expects a UnitNumber field, but in the GMARIC database, the fields have been renamed to UnitNum. Select the fields that you need to map and click the Map button.

click to expand
Figure 16.4. Mapping fields

The Match Type check box can be used to tell the Map Fields dialog to display only unmapped fields that match the data type in the Unmapped Fields list. For example, if UnitNumber is a character field, it will display only unmapped character fields. If the Match Type check box is deselected, all the unmapped fields will be displayed.

The bottom part of the window displays the files that are currently mapped. If necessary you can unmap the fields by selecting them and clicking the Unmap button.

Verifying Databases

When you first create a report with Crystal Reports, it copies the structure of the data source and uses that structure to build the Field Explorer dialog box. If there is a change to the database structure, such as a new field being added, the Field Explorer will not reflect the change until you choose the Database > Verify Database menu. If the data source has changed, then you will be prompted by a Map Fields dialog, and you will need to remap the fields as described above. If everything is okay, Crystal Reports will tell you that the database is up to date, as shown in Figure 16.5.


Figure 16.5. Database verified

You can choose File > Options > then the Database tab and choose further verify options, as shown in Figure 16.6. By default Crystal Reports will verify your report on the first refresh; you can choose to turn this feature off. Or you can choose to verify stored procedures on the first refresh, which is off by default, and then choose whether to verify when the Database driver is upgraded, which is on by default.

click to expand
Figure 16.6. Database verification options

Deploying Reports and the Crystal Repository

The Crystal Repository is a new feature with Crystal Reports 9. The repository is a database that contains objects, such as images, text objects, and report functions, that you can add to any Crystal Report.

You can think of the repository as a shared, global Field Explorer. All report writers have access to it and they can share the report objects. This makes report writing faster because you can reuse components that are added to the repository. Also, if an object changes in the repository, all the reports that use the object can be refreshed to reflect the new object. For example, if a company logo changes, all reports that use the company logo can be refreshed to show the new logo.

Before version 9 of Crystal Reports, the entire report was self-contained in the RPT file. With the repository, parts of your report can be stored in a remote database.

When you add an object from the repository to the report, Crystal copies the object from the repository to the report. It also keeps track of the object from the repository by keeping a connection to the object in the repository. It is important to keep this in mind when deploying reports if you want the end user to have access to the repository and to be able to retrieve updates.

You can disconnect repository objects if desired. If you added an object to your report from the repository and you want to disconnect it from the repository so you cannot receive future updates of that object, right-click the object and choose Disconnect From Repository.

To update your report with changes that are made to the repository, choose File > Options, choose the Reporting tab, and select Update Connected Repository Objects When Loading Reports to refresh the repository objects when the report is loaded (see Figure 16.7). If the database is secure, the user will be prompted for a user ID and password.

click to expand
Figure 16.7. Updating repository objects

Use of content on this site is expressly subject to the restrictions set forth in the Membership Agreement
 
Conello © 2000-2003     Feedback


Mastering Crystal Reports 9
Mastering Crystal Reports 9
ISBN: 0782141730
EAN: 2147483647
Year: 2005
Pages: 217

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