Consultor Eletrônico



Kbase 16015: How to group on a range of dates in Report Builder
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/10/1998
How to group on a range of dates in Report Builder


Normally, when you sort and group on a field, the group
header and footer lines print when the value in the field
changes. For example, for the following sorted and grouped
data within a field called date-field:


Date-field
--------------
01/01/96
01/11/96
02/02/96
02/22/96
03/03/96
03/13/96
04/04/96

A group footer would print in between every record since the
date is changing every record iteration.

To print a footer for each month, you need to create a
complex IIF statement that returns a unique and sequential
value for each range (each month). In the following example,
we will assume that there are only four months. Call the
calculated field calc1.

IIF(date-field > = 04/01/96, "D", IIF(date-field >= 03/01/96,
"C", IIF(date-field >= 02/01/96, "B", "A")))

If the date-field is January, calc1 holds a value of "A". If
the date-field is February, calc1 holds a value of "B"...

Instead of sorting and grouping on just the date-field, now
you need to sort and group on calc1 first then sort on date-
field. You do not see a difference in the sort order, but
there is now a group for each month that you can create group
footers and headers for.


Progress Software Technical Support Note # 16015