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

How to group by week starting on Monday

Status
Not open for further replies.

javedi

Technical User
Apr 30, 2007
196
0
0
GB
Hi Guys,

How can items be grouped by week to start from a Monday and not a Sunday as it is in Crystal Reports 10?

Any tips would be appreciated.

Thanks,
Javedi
 
Hi!

Create a formula like:
DatePart ("ww",sysdate, crMonday)

And then group on that formula.

/Goran
 
Hi Goran,

The Crystal compiler does not like sysdate. should i be replacing this with something?

Thanks,
Javed
 
You need to replace sysdate with your database date field.
The formula posted will return a number for you to group on.
If you want a date, then you can use this:

if dayofweek({table.date}) = 1
then {table.date} - 6
else {table.date} - dayofweek({table.date}) + 2

~Brian
 
Hi Brian,

Thanks for clearing this up. I did try the date field but it displayed numbers which were no use.

I'll give your formula a go.

DO you know if there is a default setting somewhere in Crystal 10?

Many thanks,
Javed
 
Sorry, I missed that one.

As Brian said it shall look like:
DatePart ("ww",{table.date}, crMonday).

That will give you the week number with a week starting on monday.

Wasn´t that what you wanted?

/Goran
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top