Kbase 15553: Printing the largest of a group of records in Report Builder
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/10/1998 |
|
Printing the largest of a group of records in Report Builder
How to print the largest of a group of records in
Report Builder.
In order to print the record in a group of records with the
largest value in one field, you must create a pre-pass
aggregate field to find the largest value, then print the
detail line conditionally on the current field being equal
to the aggregate field.
To print the detail line on the condition that the current
filed is equal to the aggregate field, you must create a
calculated field using the IIF function and print
conditionally on this field.
The following is an example using the sports database.
Create new report using the sports database. Create joins
between the customer and order tables and the order and
order-line tables. Place the cust-num and name fields from
the customer table, the order-num and order-date fields
from the order table, and the line-num and item-num fields
from the order-line table on the record line of the report.
Create a sort on cust-num to order the report.
Preview the report to see the data before it is processed.
You can see that 4/5/93 is the most recent date for
customer number 1 (lift line skiing) and 3/26/93 is the
most recent date for customer number 2 (Urpon Frisbee).
Create an aggregate field that finds the maximum order-date
from the order table, click the options button, click on
"1)Cust-Num" in the Reset combo box, and check the pre-pass
toggle box. The reset tells the field to reset the
aggregate and find the maximum for the next group of
records. Name this field maxdate and click OK.
Create a calculated field and name it printif. Enter the
following expression- IIf(Order-Date = maxdate,true,false).
This calculated field will be true if the current value of
order-date is equal to the value in maxdate (which is the
largest date of this group of dates).
Open the band line properties for the record line. Click
on the enable print conditional toggle box. Select the
printif calculated field you created as the field to print
conditionally on. Select the print when field is True
radio button.
Preview the report. It will print all the information for
the records associated with the order record with the most
recent date.
Progress Software Technical Support Note # 15553