Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

2.06 Adding Report Objects

Adding Report Objects

The majority of your time spent designing reports is spent working with the report objects. Crystal Reports gives you many types of objects for designing reports. Learning how each works is critical to being a proficient report writer. This section covers most of the available report objects (the more complex ones have their own chapter).

There are two classifications of objects that can be added to a report: report objects and field objects. Report objects are the building blocks of a report. They let you display data from a database, draw graphics and show charts for more complex printing. By understanding the purpose of each report object and how to best use it, you can create reports that display complex information in an easy to read format.

Field objects are shown in the Field Explorer window and they can be dragged and dropped onto the report. For this chapter, we’ll keep it simple and focus on report objects. The different field objects are covered in separate chapters because they are much more complex than the typical report objects.

The easiest way to add a report object to the report is using the Insert toolbar (shown in Figure 2-8). The toolbar has an icon for each type of object that can be dropped onto the report. Click on the object to insert and, depending upon the type of object it is, the mouse changes so that you can place it on the report.



Figure 2-8. The Insert toolbar

The second method of adding an object to a report is using the Insert menu. Click on the Insert menu at the top of the program and it lists all of the objects that can be added. It works the same as the toolbar: click on the object to insert and move the mouse to where the object should be placed.



Figure 2-9. The Insert menu option.

A third method is to right-click on a report and the pop-up menu gives you a few insert options. However, this menu only lets you insert text objects, a cross-tab or a chart. Its uses are limited and I personally find myself relying on the Insert toolbar most of the time.

There are a lot of different objects that can be used on a report and there are many ways to use them. Most people learn best by example, so let’s create a report that uses all the objects and shows the different ways they can be used. What we’re going to do is create a report “sandbox.” I call it a sandbox because we’re just going to play around with the different objects and see what happens. It’s like being a kid, where you just want to throw all your toys in it and get messy. We’re not going to worry about making things look pretty right now. We just want to see how everything works.

The first thing to do is create the “sandbox” that we’ll be working in. We’ll create a blank report that uses the Employee table as its data source. For right now, we won’t even add any fields to the report. We just want them to be available when we need them.

  1. Go to the Crystal Reports Start Page and click on the Blank Report option under the New Reports heading. This opens the Database Expert dialog box.
  2. In the Database Expert dialog box, open the Create New Connection node and select the Access/Excel (DAO) option. This opens the Access/Excel (DAO) dialog box.
  3. Click on the button to the right of the Database Name input box and navigate to the Xtreme.mdb database. The default installation folder is

C:\Program Files\Business Objects\Crystal Reports11\Samples\en\Databases\Xtreme.mdb

  1. Click the Finish button to save the database connection.
  2. Open the Tables category and double-click the Employee table. This adds the Employee table to the Selected Tables list on the right.
  3. Click the OK button to accept the changes.
  4. Click the menu options File > Save As and enter the filename Sandbox.rpt. Click the Save button.

You now have a blank report that uses the Employee table as its data source. If you look in the Field Explorer window and click on the Database Fields category, you should see the Employee table listed. Let’s play!

The Text Object

The text object is used to display text, database fields, and special report fields. Each text object can display one of these or a combination of all three. After adding a text object to the report, you have to enter the text to display. If you want to go back and edit the text, double-click on it.