Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grouping by date ranges 1

Status
Not open for further replies.

itkyle

IS-IT--Management
Feb 13, 2002
31
0
0
US

I have a report that is run based on a date range, which I usually select from the Select Expert. Since there are now 9 or more ranges needed, this is getting to be a pain (essentially I'm having to run the report 9 times, once for each range).

Compounding this, different clients need the report for different ranges. For one client, I run the report for the period 3/31/94-3/30/95, continuing through all years until 3/31/02-3/30/03. For another client, the period can change; one period could be 12/01/98-03/31/99, then 4/1/99-3/31/00.

I know I'd need to save these reports separately for each client; what I'd like to do is just be able to run them once to cover all desired periods, just breaking the page and resetting the page numbers when the period changes for that client.

I hope I've made this clear enough...if not, let me know and I'll give whatever info is needed.

Thanks in advance.

Kyle
 
You can create a formula field that says:

if {Date} in date(1994,3,31) to date (1995,3,30)
then (1995,3,30) else
if {Date} in date(1995,3,31) to date (1996,3,30)
then (1996,3,30) else
if {Date} in date(1996,3,31) to date (1996,3,30)
then (1995,3,30) else ....

Then group on this field and add a page break. As long as the same record doesn't need to be in two different groups, you are all set. You could even write one formula for each customer, and then group on a formula that selects the appropriate customer based on a parameter. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Ken -

Once again, the Tek-Tips gurus have really come through for me! Thanks a ton for your help.

Now an aesthetic issue - how can I get those individual date ranges to print in the page header (e.g., "Period: 3/31/1994 to 3/31/1995)")? I'd like each section to show the period represented.

Thanks again for all the great help.

Kyle
 
Write an opposite formula:

if {@Firstformula} = date (1995,3,30)
then "3/31/1994 to 3/30/1995" else if {@Date} = ... Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top