Reports Information
You can build Report Forms as reusable parts to be embedded
in other reports. Reusable report forms can help you reduce the number
of connections in your report parts, reuse commonly used reporting fields, and
produce standard report parts, like letterhead.
The following example shows you how to create a reusable header for a
report. This example leads you through the process of replacing the
header in the field breaks example with a standard, reusable form. It
explains how to create a reusable form, add fields to it, create a variable
that will be used for the title of the report in which the form is embedded,
and embed the form in a report. When you finish, the field breaks
sample report will look similar to the following:

Creating the report form
To create a report form, follow these steps:
- Create a new report part from the VisualAge Organizer.
- Delete the Report Shell from the free-form surface of the Composition
Editor.
- From the Reports category of the parts palette, select a Report Form part
and drop it on the free-form surface of the Composition Editor.
Adding fields to the form
To add graphic and text fields to the form, follow these steps:
- To add a graphic to the form, select the Report Image Field part and drop
it on the Report Line in the form.
- Open the settings of the Report Image Field part and make the following
selections:
- For graphicsDescriptor, select Image. Use the
Browse button to search for a bitmap to include in the form.
- For unitTypeSelected, select Inches, set
x to 0, and set the height and width of the image to 1.
- For sizeEffects, select size image to field.
- To widen the report form, select it and then drag the selection
handles.
|
| If you need to set the form to an exact width, do the following:
- Drop a report shell on the free-form surface.
- Move the reusable report form to the body of the report shell.
- Drag the selection handles of the report form to size it to match the size
of the report body in the shell.
- Move the form back to the Free-form surface and delete the report
shell.
|
- To add a text field to the form, select the Report Text Field part and
drop it on the Report Line to the right of the image.
- Open the settings of the Report Text Field part and make the following
selections:
- Set the object property to VisualAge Sample
Reports.
- Set the unit type to Inches and set x to 1.
- Open the font selection window and select a typeface, weight, and
size.
- Change the foregroundColor property to a different
color.
- To widen the text field, select it and then drag the selection handles
until the field fills the remaining width of the report line.
- To add another text field to the form, select the Report Line part and
drop it on the Report Form below the image.
- Open the settings of the default Report Text Field part and select a value
for x, font, and color, but do not enter any text for the part.
- Resize this field to fill the entire report line.
Adding a variable
The text on the line you just added will be filled in with the title of the
report in which the form is reused. To add a variable for the report
title, follow these steps:
- To create a variable for the report title, select the Variable
part from the Models category and drop the variable on the free-form
surface.
- From the variable part's pop-up menu, select Change Type
and in the window that displays, type String.
- Change the name of the variable part by selecting Change Name
from its pop-up menu and typing ReportTitle in the window that
displays.
- To make the variable visible to the report in which you embed the form,
select Promote Part Feature from the variable's pop-up menu,
and then select self from the list of attributes.
- Connect the self attribute of the variable part to
theobject attribute of the Report Text Field in the second line of
the form.
Notice that the default text changes to [self].
Your report form is complete. It should look similar to the
following in the Composition Editor.
- Save the part and close the Composition Editor.

Reusing the form
To add the reusable report form to a report, follow these steps:
- Open a Composition Editor on the field break example you created earlier
in this chapter.
- Delete the date, title, and time fields from the report header.
- Open the settings for the Report Shell and increase the top margin of the
report to 2.25 inches.
- From the Options menu of the Composition Editor, select
Add Part; then in the window that displays, type the name of
your reusable report form in the Class name field and make sure the
part type is Part.
- Drop the form onto the header of your report.
- Now connect the reportTitle attribute of the reusable form to
the title attribute of the report shell.
The header of the report should look similar to the following.

Now when you test your report, it should look like the illustration at the
beginning of this section.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]