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

Change first day off week

Status
Not open for further replies.

cm1234

Technical User
Oct 18, 2002
41
DK
Hi everybody
CR 8.5

I need to get a report to start with first day off week
on a monday instead off sunday as in CR,
can anybody help me.

best regards
cm1234
 
Hi CM1234,

You may not know that the Search feature is working again, I answered this question in thread767-438413

Here is the text of the thread:

This should work and puts sunday in the previous week in the details.

//begin
datevar grpwk;

grpwk := if dayofweek({Table.datefield})= 1 then
(date({Table.datefield})-6) else
(date({table.datefield}-dayofweek({table.datefield}))+2);

grpwk

//end

Also, to display the correct Monday date in the group tree as well as on the report - customize the groupname (assuming you are using @grpwk) (you can right click/change group/customize group name/formula and enter:

ToText({@GrpWk})

This will display Monday's date as the group name and as such in the Group Tree - otherwise it is confusing to see two different dates.

Hope that helps,

ro
Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
By Default DayOfWeek( returns 1 if it's a Sunday, 2=Monday,etc.)

The other useful formula is
(table.datefield) - dayofWeek({table,datefield})
always takes you bak to the previous saturday.

So you need a Start of Week formula of
If dayofWeek({table,datefield}) =1 then //sunday
(table.datefield) - dayofWeek({table,datefield}) -5
else //Monday onwards
(table.datefield) - dayofWeek({table,datefield}) + 2 Editor and Publisher of Crystal Clear
 
Hi

I think that i didnt explain my problem correct
as the formulas you have given to me works
and that is great, but,
my mean consern is to use the weekdays in a report starting with monday and ending with sunday and again to keep thos
seven days together in the report, as a group.

best regards
cm1234
 
Dear CM1234,

That is the purpose of my formula - did it not work for you?

When you created the formula and grouped on it - what was the result then if not what you wanted?

Happy to help, need to understand the issue.

ro
Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top