Saving Report Data
Crystal Reports lets you save the report data with the .RPT report file. This gives you two primary benefits. The first being that the user doesn’t need to have a live connection to the data source. This lets you email the .RPT file to someone working off-site and they can view the report. The second benefit is that if a report takes a long time to pull its data from the database and process the report, then the report can be loaded in a fraction of the time when the data is saved with it. There is no need to request the data from the server and process it locally.
Even though saving data with reports makes it much more efficient to view reports, you can do even more to improve performance. If a report has over 10,000 records, but those records are viewed in small sets, then you should create Saved Data Indexes. This creates indexes on the computer to process the records returned from the record selection formula more efficiently. To create Saved Data Indexes, select the menu items Report > Report Bursting Indexes. When it opens, select the fields that you would use in the record selection formula and save it. However, if the record selection formula returns the majority of the data in the report, then you won’t see the performance gains due to the overhead required to create the indexes. So only do this if you think the record selection formula will return a much smaller number of records.
In one respect, saving data with the report sounds similar to the benefits of just converting it to a PDF file and then emailing/viewing the PDF file. After all, both methods let the user view the report without accessing the live database. The benefit to saving the data in the report and keeping it in the native Crystal Reports format is that the reader is still able to work with the data. For example, they can drill-down into groups, enter new parameter values, change the sorting, etc. This isn’t possible when viewing a static PDF file.
To make sure that drill-down data is also saved with your report, disable the option Perform Grouping on the Server. This is found under the menu options File > Report Options.
You need to plan what data will be saved with your report. If you expect a user to massage the data once they get the report (e.g. changing parameters, use different sorting, etc), then you have to make sure that they have all the data they need. For example, let’s say that you are working with the report and you set the record selection formula to be all Customer IDs less than 100. When you send the report to the user, then this is the only data that they will have. If they try to change the record selection formula to Customer IDs less then 500, then there won’t be any additional data available for printing. The original records are still the only records in the report. The user would have to reconnect to the database server to read the Customer IDs less than 500.
The key to making sure that the report has the right data is to determine what data actually gets saved with the report. Crystal Reports doesn’t have a feature to view the raw data associated with a report, so you have to figure it out yourself. A good rule of thumb is that anytime Crystal Reports has to communicate with the database server, then it is getting a new copy of the data. Some examples of this are when you log on to the server, add a new field to the table, or verify the database (when the structure has changed). In many cases, you’ll know that new data is being retrieved when you are prompted with the question “Refresh Data?” and you answer Ok.
Re-querying the database commonly happens after you click the Refresh Report Data (F5) button, enter a new selection formula, enter new parameter values, etc. At this point you can save the report and all the data will be saved with it as well. If you decide to continue testing the report with new parameter values or selection formulas, then always tell the report to “Use Saved Data” so that it doesn’t re-query the database. By telling it not to refresh the report data, then you always keep the last set of data stored with the report. Even though you might not be viewing it at that moment, whomever you send the report to will still have access to all the data.
Although Crystal Reports doesn’t let you see the actual data saved with the report, it does give you some high-level information about it. The Performance Information dialog box gives you information such as how many records are saved, the record size, and how much space the data requires. Open the Performance Information dialog box by selecting the menu items Report > Performance Information. Then click on the Saved Data node. It is shown in Figure 10-14.
Figure 10-14. Viewing saved data statistics with the Performance Information dialog box.