Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

13.03 Linking Tables

Linking Tables

Whenever there are two or more tables, they need to be linked so that Crystal Reports knows how they are related. For example, a pet store that wants to print a list of its products by Animal Id needs to build a report using an animal table and a product table. To match the product to the appropriate type of animal, both tables will be linked by the Animal Id. It would be impossible to determine which products are associated with which animal without this link. The Links tab, shown in Figure 13-2, sets the linking fields.



Figure 13-2. The Links tab.

When the Links tab is first displayed, it creates default links. This is the equivalent of Crystal’s “best guess” for the relationships between the tables. In an effort to make it easier for you, Crystal Reports tries to figure out which fields in each table should be linked to each other. It does this based upon indexes and fields that have the same name and data type.

To get the most benefit out of the auto-arranged links, design your tables with field names that use a consistent naming convention and have well thought out indexes. This will result in a higher probability that Crystal Reports will create the appropriate default links.