Print "Range" selection criteria in report header

Product/Release:Crystal Reports for LANSA
Abstract:The Minimum and Maximum functions can be used to collect the lowest and highest value of a field, and use these to print the actual range of the data in your report in the report header. This is handy if you select data within, for example, a specific date range or product range.
Submitted By:LANSA Technical Support

The Minimum and Maximum functions are particularly useful to print, for example, the selection criteria of data, if it is a range, in the report heading.

If a report contains, for example, the sales data of a specific period, it might be necessary to print that information in the header of a report. With the Minimum function the lowest occurrence of, for example, the transaction date can be captured and with the Maximum function the highest occurrence of the transaction date can be captured. This date range can then be printed in the report header or footer. The Date related functions can be used to print the date in a specific format.

The Minimum and Maximum functions can be used on both numeric and alphanumeric fields. The above picture shows how the range of products selected for this report is printed in the heading.

To print the lowest occurrence of a field in a report:

  1. Insert a formula field (select the Insert Formula command from the Insert menu) and give the formula a name. This displays the Edit Formula dialog box.
  2. Create the formula by just 2 clicks:
    • Click on the Minimum function. (arithmetic function)
    • Click on the field for which the lowest occurrence needs to be known (field box)

The 2 clicks result in a formula like this:

Minimum ({SALES_DATE})

To print a range extend the formula to be:

Minimum ({SALES_DATE}) + " to " + Maximum ({SALES_DATE})

The tip about parameter fields explains how parameter fields can be used to print the exact selection criteria prompted for, rather then collecting this information from the data. Both ways have their own advantages.