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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Future Date Grouping

Status
Not open for further replies.

pbisaillon

Technical User
Aug 18, 2003
7
CA
Hi, I am trying to group a date field that will display records that fall within a 3 year date period. I noticed in Crystal 8.5 that when you group a date field you have the option of selecting how the section will be printed (ie: for each year, each quarter, etc..) I would like to be able to print the section and have it grouped for each 3 years, or each 2 years etc..

Any ideas on how I can do this?

Thanks,
Patrick
 
You could create two discrete number parameters:
{?startyear} and {?noyrsingrp} and then create a formula like the following to group on:

if year({table.date}) in {?StartYear} to {?StartYear} +
{?noyrsingrp}-1 then
totext({?StartYear},0,"") + " to " + totext({?StartYear} +
{?noyrsingrp}-1,0,"") else
if year({table.date}) in {?StartYear}+{?noyrsingrp} to {?StartYear} +
({?noyrsingrp}*2)-1 then
totext({?StartYear}+{?noyrsingrp},0,"") + " to " + totext({?StartYear} +
({?noyrsingrp}*2)-1,0,"") else
if year({table.date}) in {?StartYear}+({?noyrsingrp}*2) to {?StartYear} +
({?noyrsingrp}*3)-1 then
totext({?StartYear}+({?noyrsingrp}*2),0,"") + " to " + totext({?StartYear} +
({?noyrsingrp}*3)-1,0,"") else //etc.
"Other"

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top