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!

Display day and month for a week group

Status
Not open for further replies.

SuperTime

Programmer
Dec 21, 2004
183
US
Crystal 9.
Sql Server 2005

I have a week group on the report which is based on the following formula: datepart("ww",{CompTimeBlocks.StartDate})

In the group header section i have placed text boxes that display "Mon" "Tue" "Wed" ...."Sat"

Now my goal is based on the date range entered display the appropriate date and month. So for example if I run the report for 7/29/2008 - 7/29/2008 (only for a single day, I can sometime enter a week, or more than a week)

The report should dispay
Mon Tue Wed Thur Fri Sat
28-Jul 29-Jul 30-Jul 31-Jul 1-Aug 2-Aug

I already have the formulas written, but the problem is my report currently displays the following wrong months for friday and saturday, only when it has to cross to the next month otherwise if it has to display a week within the same months, it works correctly.
Mon Tue Wed Thur Fri Sat
28-Jul 29-Jul 30-Jul 31-Jul 1-Jul 2-Jul

The formulas I have are:
@MinStartDate
({CompTimeBlocks.StartDate} - Weekday({CompTimeBlocks.StartDate}))+ 2

@1stdayofweek
DateSerial(year({@MinStartDate}), month({@MinStartDate}), day({@MinStartDate}))

@2nddayofweek
DateSerial(year({@MinStartDate}), month({@MinStartDate}), day({@MinStartDate}+1))

@3rddayofweek
DateSerial(year({@MinStartDate}), month({@MinStartDate}), day({@MinStartDate}+2))

.....
@6thdayofweek
DateSerial(year({@MinStartDate}), month({@MinStartDate}), day({@MinStartDate}+5))

 
I tested your original formulas and they worked just fine for me.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top