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

Group problem with date formula field

Status
Not open for further replies.
Joined
Feb 26, 2004
Messages
58
Location
US
I am a fairly new user of Crystal Reports 9.
I have a formula field on my report as follows.
CURRENTDATE - datefield = @DOM

I am trying to group my report by the @dom field which is numeric.

I want to group by 180 days or more
120 to 180 days
90 to 120 days
under 90 days

When I put in the Group Selection:
@dom <= 180
the error comes up that I need a string

If i put in @dom"180" the error comes up that I need a numeric number?

Can you help me on this?

Thank You


 
Modify you formula to this:
Code:
WhileReadingRecords;
CURRENTDATE - {table.datefield};
Create a group on this formula.
In the Group dialog box, change the order from ascending to specified. This will create another tab called Specified Order.
Click the New button
Type "180 days or more" in the Group Name box.
The condition will be "greater than or equal to" in the drop down box, and "180" for the value.
Continue to create the other 3 groups you need and their proper conditions.
Click OK and test it out.

~Brian
 
I haven't seen Crystal 9, but in 8.5 I would try something like this:
Create a formula field to group on called GroupFormula;

If CURRENTDATE - datefield < 90 then 1 else
If CURRENTDATE - datefield < 120 then 2 else
If CURRENTDATE - datefield < 180 then 3 else
If CURRENTDATE - datefield >= 180 then 4

Then group on formula field GropuFormula.

Hope this helps,

MrBill
 
Create a formula to group on:

If currentdate-datefield > 179 then
1
else
If currentdate-datefield in [120 to 179] then
2
else
If currentdate-datefield in [90 to 119] then
3
else
If currentdate-datefield < 90 then
4
else
5

The last should be a catch all for other possibilities

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top