Reports Information
When you create a reporting application, you need to consider several
design options that affect how you create, reuse, and test your
reports.
Creating report parts
There are two ways to add reports to an applications:
- In the visual part for your application, you can drop a Report Shell part
onto the Composition Editor next to your window part. If you construct
a report this way, you can make direct connections between your report part
and the other visual and nonvisual parts in your application.
- Create a separate, reusable report primary part. This way of
creating reports gives you greater flexibility in changing and reusing
reports. If you construct a report this way, then you also need to
provide a way of passing information from your visual part to your report
part. In general, you do this using variables as follows:
- Create separate visual and report parts in your application.
- For each object that you want to report on, add a variable to the report
part and promote the variable as an attribute in the report part's public
interface.
- In the visual part, use the Options ==> Add
Part menu option on the Composition Editor to add the report part to
your visual part.
- Connect the objects in your visual part to the attribute that represents
the object in the report part.
In the sample application that you will construct in this book, you will
see two examples of passing information between a visual part and a report
part:
- Passing a value from the visual part to be used as a host variable in a
database query in the report part
- Passing an ordered collection created in a visual part into a report part
Testing report parts
If a report requires that information be passed to it from another part,
you need to be careful about how you test it. You need to either test
it from the visual part, so that you can pass the information to the report
from the user interface, or create an initialization method in the report part
with sample data to be passed to the report.
When you open a Composition Editor on a report part, you will see that it
has a test button much like the test button for visual parts. If you
write an initialization method for your report, then the information in it
gets passed to the report when you test it.
The sample application in this book leads you through two ways to test your
report: from the application's user interface and from the
Composition Editor open on the report part. You can also test a report
by selecting the class name from the Parts list in the VisualAge
Organizer and then selecting the test button.
If you create a report that does not require information to be passed to it
from another part, you can test it simply by selecting the test button on the
report part's Composition Editor.
Using quick reports
The VisualAge Reports feature supports two different types of quick
reports:
- A quick report iterator for generating report fields for each item in an
iterable object. This type of quick report enables you to report on
each row from a database result table, for example, or each item in a
collection.
- A quick report form for reporting on a single item from an iterable
object. This type of quick report enables you to report on the current
row in a database result table, for example, or the current item in a
collection.
The quick report function automatically generates the type of quick report
you need according to the object you request a quick report for:
- To generate a quick report iterator for all rows in a database result
table, for example, you select the Quick Report option from the
query part's pop-up menu, and then select the resultTable
attribute.
- To generate a quick report form for the current row of a result table, you
tear off the resultTable attribute, select the Quick
Report option from the resultTable part's pop-up menu, and then
select the currentRow attribute.
The sample application that you can build by following along this book
shows how to generate both types of quick reports. It explains how to
generate a quick report form for the current row of a database result table
and how to generate a quick report iterator for every item in an ordered
collection.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]