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

Custom Group -> Specified Order. Custom selection criteria?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
USING CR 9

Problem: Group records into the following groups: 0-1 Months, 1-3 Months, 3-6 Months, 6-12 Months, 1 Year and older

I know to go Insert->Group, select "in specified order", then click the specified order tab, and create groups. The problem I'm having is Crystal's restraints are pretty limited (1-3 months is "31-60 Days OR 61-90 days) and I can't create a group for 3-6 or 6-12 months.

I keep looking for a formula box but can't seem to find one. It wouldn't make any sense to me if I couldn't define custom selection criteria.
 
Create a formula such as:

whileprintingrecords;
if {table.date} >= datserial(year(currentdate),month(currentdate)-1,day(currentdate)) then
1
else
if {table.date} >= datserial(year(currentdate),month(currentdate)-3,day(currentdate)) then
3
else
if {table.date} >= datserial(year(currentdate),month(currentdate)-6,day(currentdate)) then
6
else... you get the idea, the dateserial function takes the pain out of this for you.

Then just Group on this field.

-k
 
Just for anyone else that views this post, you have to remove the "WhilePrintingRecords" clause in order to use the formula when grouping.

I think "WhilePrintingRecords" means to do it during the second pass, which is where all grouping is done, so Crystal wouldn't know about the formula results until the 3rd pass.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top