Lesson 6: Working with reports

Lesson 6 will show you how to create a report based on the data model you created in Lesson 3. Make sure you have a printer installed on your system before starting this lesson.

In this lesson, you will

  explore the Report Design window
  
  create a report based on a data model
  
  customize your report
  
  use the print options to get the result you want
  
You'll need about 30 minutes to complete this lesson.

To see what your completed report will look like, click here.

Note

  Make sure your working directory is set to the folder where you saved the Tutorial sample files. If necessary, see "Setting your current working directory" in Lesson 2 for more information.
  
Creating a Report 

Reports, also known as design documents, provide a way to view information in your database, either on your computer screen or as a printed document. As with forms, you can create reports that link tables together so that information stored in separate tables can be combined into one report.

One of the main differences between forms and reports is that reports have bands - horizontal lines that divide the report into portions on the Report Design screen. Bands are displayed as sets consisting of a header and a footer. Three sets of bands - report, page, and record bands - appear automatically. 

In Lesson 3, you created a data model to support the sale of training videos by the Training-By-Design company. If you were a Sales Manager with the company, you would probably want a listing of the videos that were sold in the last six months. Using the Data Model method, we'll begin by creating a simple report based on TBDReport.DM in your TUTORIAL folder.

To create a report

1.	Click File menu, New, Report.

2.	In the New Report dialog box, click Data Model.

3.	From the bottom list box in the Data Model:New dialog box, choose Data Models.

4.	From the above list box, double-click TBDReport.DM.

The data model automatically appears in the display window on the right side of the dialog box.

5.	Click OK.

The Design Layout window appears allowing you to make changes to your report layout.

Note

  Where you position objects within the report bands will have an impact on the data presented in the final report. For example, the information placed in the page band is repeated on each page of the report. Any fields placed between the record bands repeat for each of the records in the associated tables. The bands themselves do not appear on the printed version of the document.
  
Changing the Report Layout

The Design Layout window for reports is identical to that used for forms. It contains the same two or three-page panel of options on the left side, and a display window on the right. Each option you choose appears in the display window so you can see the effect your selections have on the report design. 

To change the report layout

1.	In the Design Layout dialog box, click the Fields tab.

2.	In the Selected fields list box, remove all the fields except the following:

  ORDERS.OrderNo
  
  ORDERS.ItemNo
  
  ORDERS.CustomerID
  
  CUSTOMER.FirstName
  
  CUSTOMER.LastName
  
  CUSTOMER.CompanyName
  
  VIDEO.TITLE
  
  VIDEO.PRICE
  
  ORDERS.QTY
  
3.	Use the Order arrows to put the fields in the above order.

4.	Click the Layout tab.

5.	On the Layout page, enable By columns in the Field layout box, Multi-record in the style box, and Horizontal in the Multi-record layout box.

6.	From the Style Sheet list box, choose the Framed style sheet.

7.	Click OK.

The Report is displayed in the Report window in Design Report view.

Customizing your reports

Customizing a report is similar to customizing a form. The Design Layout dialog box lets you set field layout and style, define detail table style, and add or remove fields from your design. To further customize your report, you can use the variety of tools available in the Toolbar, or right-click any object on the Report Design screen to change the properties or define the field.

Make sure your report is open in the Design Report window.

To move an object on your report

1.	Select the Multi-record page.

You will know that the Multi-record page is selected because the Status Bar will display ORDERS [Multi-record].

2.	Hold down SHIFT and press the DOWN ARROW to move the records down and create room for a title above the records.

To add text

1.	Click the Text Tool in the Design Object Toolbar.

2.	Click above the records on the report to place the text.

3.	Follow each of the steps in the Text Expert dialog box to add the following text:

"Training By Design"

The Text Expert guides you through choosing the desired typeface, size, style, and color, and selecting a special effect and alignment.

4.	Click and drag the Text object to position it at the top of the report.

Note

  There are a number of other customizing options you can apply to your report. For example, to move an object, select the object and drag it to a new position on the report. You can experiment with the Properties of your objects and add new objects. If you add a new object, then decide that you no longer want it on the report, select the object and press DELETE. 
  
Defining fields for your report

To make the most efficient use of hard drive space when you are planning a database, you do not include fields in a table that the system can easily create for you. Paradox allows you to add a field to your report and define it to store a value based on a calculation. Fields such as sums, averages, sub-totals, and totals can be created as defined fields.

You define fields for a report in the same way as for a form. Even though you defined the TotalPrice field as a calculated field in the form, you need to define it again for the report. You also define Special fields, which add a date, timestamp, or page number to your report.

To add a new field

1.	Select the first record frame.

2.	Use the record frame marker to drag the bottom of the record down to create room for an additional field.

3.	Select the Price field.

4.	Click Edit menu, Duplicate.

The new field will appear on top of the Price field. 

5.	Select and drag the field beside the price field.

6.	Right-click the new field and choose Properties.

7.	On the General page, type TotalPrice in the Name of Object box.

8.	Click OK.

9.	Select the label of TotalPrice and rename it to Total Price. You will have to click the field two times to edit the label.

To create a calculated field.

1.	Select the Total Price field.

2.	Right-click the edit region and choose Define field.

3.	In the Define Field Object dialog box, click in the Calculated box to enable it.

4.	In the box under Calculated, enter the following expression:

[ORDERS.Qty]*[VIDEO.Price]

Make sure you enclose the fields in square brackets.

5.	Click OK.

The expression you entered tells Paradox to multiply the ORDERS.Qty field value with the VIDEO.Price field value and enter that value into the Total Price field.

To add a Special field

1.	On the Page band, select the <Today> field.

2.	Right-click the <Today> field and choose Define Field.

3.	In the Define Field Object dialog box, click the list box under Special field and choose Timestamp.

4.	Click OK.

Paradox adds a timestamp to the top of the page.

Running and Saving your report

Now that you have created a report, you can run it and view the information in the records. You should also save your report if you want to use it again in the future.

To run your report

  On the toolbar, click the Run Report button.
  
Paradox runs the report and shows the multi-record format. Notice that the time stamp you added to the top right-hand corner of the page shows the time and date when you run the report.

To save your report

1.	Make sure you are in Design Report mode.

2.	Click File menu, Save As.

3.	In the Save file as dialog box, type VideoSales in the File name box.

4.	Click Save.

Paradox assigns the default *.RSL file extension.

Next you are going to print the report.

Printing your report

When you print your report, you have to consider several items regarding the look of your final document. You can choose between portrait and landscape orientation, identify the number of copies you would like, determine how you want to handle information that doesn't fit on the page, and decide whether you are designing for your screen or your printer. 

You can choose to print the design of your report, or the completed document with or without data. 

To access the Page Setup dialog box

1.	Click View, Design Report.

2.	Click File menu, Page Setup.

3.	Choose the options you want to apply to your report.

To print your report in Run Report mode with data

1.	Click File menu, Print.

2.	In the Print dialog box, specify the print properties.

3.	Click Print.

To print your report in Design Report mode with data

1.	Click File menu, Print, Report.

Paradox runs the report.

2.	In the Print dialog box, specify the print properties.

3.	Click Print.

To print the design of your report in Design Report mode

1.	Click File menu, Print, Design.

2.	In the Print dialog box, specify the print properties.

3.	Click Print.

Summary of Lesson 6

In this lesson you learned how to

  work in the Report Design window
  
  create a report based on a Data Model
  
  customize your report
  
  use various print options
  
In Lesson 7 you'll learn how to create a query to retrieve information from your database.

Finished Report in Report Design view.








