Using Unlinked Tables
In most reports, when you add multiple tables to a report it is assumed that you will link them together. But Crystal Reports gives you the ability to use standalone tables in a report that aren’t linked to the other tables. At first this can cause problems because there is no synchronization between the two data sources. If you put fields from both data sources in the details section, Crystal Reports will print out the detail records for both tables accordingly. But since they aren’t linked, the results can be a little chaotic. It could also create a Cartesian result set where each detail record in one data source is repeated for every detail record in the other data source. This results in a report where the page count quickly explodes into the thousands. In fact, when you add an unlinked table to the report, Crystal Reports gives you a warning message that doing this is generally not supported.
Figure 10-20. Warning message for unlinked tables.
As a general rule, if you want to print the detail records from multiple data sources, then you need to use subreports. This lets you group the detail records into separate reports to keep the data organized. With all these potential problems of unlinked tables, is there a time you would want to use them? Of course.
Unlinked tables are helpful when you only want to print a single record from the table. This can either be a table with one record in it, or a table that uses a record selection formula to only return a single record. This makes it easy for Crystal Reports to extract the correct information from the table and since there is only one record, you don’t have to worry about getting a Cartesian result set.
The primary use for unlinked tables is putting information in the report/page header or footer. If you remember back to the discussion of subreports, there was one example where we put the corporate contact information into the report header. We used an unlinked subreport to pull a single record from the table and display it in the page header. In this example, you could easily replace the subreport with an unlinked table. This makes the report easier to develop and maintain because all the data sources are contained in the main report and you don’t have to use subreports. You could also use unlinked tables when there is a utility table that stores property-value pairs that store regularly changing data (like tax rates) and using them in a formula.