Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

13.18 Set Alias Menu Option

To manually change the alias of a table, right-click on the report and select Database | Set Alias. This opens the Database Expert dialog box with the current connections shown in the right-most window. Click on the table that you want to assign an alias to and press the F2 key. This puts the name in edit mode and you can change it.

If you are using multiple data sources, it’s possible that you will add two tables with the same name to your report. Crystal Reports forces you to give one of the tables an alias so that there isn’t a naming conflict. Before it lets you add the table, it prompts you with the Database Warning dialog box in Figure 13-10. It tells you that there is already a table with that same alias and asks if you really want to add it to your current connections. If you click Yes, then it prompts you to enter a new alias name. The table gets added to your current connections using the new alias name.



Figure 13-10. The Database Warning dialog box.
It isn’t obvious when a table is using an alias that is different than the actual table name. If you are given a report that you didn’t design, a table that uses an alias can make it difficult to determine what the actual table is. To find out which tables have aliases and what table is used, open the Set Location dialog box. The drop down box lists the table aliases that are associated with each data source. When you click on the table name, the detail section below the drop-down box changes to show you the details about the alias. The actual table name is shown in this information. The following figure shows that the alias CustomerData references the Customer table.


Figure 13-11. Finding a table’s alias.