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

More Date Fun 1

Status
Not open for further replies.

Cort

MIS
Apr 16, 2002
154
US
CR 9.0

I'm looking to show dates in a xtab. What I'd like to do is have a formula that if [date.created] is within the last 7 days then show the data by individual day but if the [date.created] is older than 7 days then clump it into a single column.

The output would look something like this:

Code:
            over 7 days  9-24-04     9-25-04     9-26-06     9-27-04
contracts     205          4            5           2            7

I know how to use formulas for dates in x-tabs but can't wrap my head over how to properly do this one.

Thanks again as always.

 
This is the formula I thought should work but it's giving me only true/false for some reason.

Code:
if {date_created} > (currentdate - 6) then {date_created} = 
DateTime (2004, 08, 08, 00, 00, 00) else {date_created} = {date_created}
 
I use Crystal 8.5, but I think it is the two {date_created} = commands that cause the problem. Take them out, or do something like
Code:
if {date_created} > (currentdate - 6) 
then Totext({date_created}, "dd MMM yy")
else "Older"

Then group on the contents of the formula field. Note that you could also used DatePart to split the older dates into months etc.


Madawc Williams (East Anglia)
 
That worked great. Thanks. Yeah DatePart can come in handy here also.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top