Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Group by Sepcified Date(Day) Ranges Post Reply Post New Topic
Author Message
lawrenceks
Newbie
Newbie


Joined: 07 Aug 2014
Online Status: Offline
Posts: 6
Quote lawrenceks Replybullet Topic: Group by Sepcified Date(Day) Ranges
     Posted: 08 Aug 2014 at 6:06am

I need to create a reported sorted by date range.

The dates need to be as follows:

Week 1 = The 1st day of the month thru the 7th day of the month (MM/01 - MM/07) Week 2 = The 8th day of the month thru the 14th day of the month (MM/08 – MM/14) Week 3 = The 15th day of the month thru the 20th day of the month (MM/15 – MM/20) Week 4 = The 21st day of the month thru the end of the month.

I tried using the Group Expert, Options, and The Sort for Each Week function, but it only works for Sunday-Saturday weeks, not the first seven days of the month as a week.  I believe that I should be able to Use a Formula as a Group Sort Order, but I am not sure how to write it to group the weeks as described above.

I tried using the Select Expert, The ‘is between’ function only works for specific dates, for example June 01, 2014 – June 07, 2014.  If I try to run this same report in July, it would not work.

I need this function to be usable at the end of every month when the report is printed for that month.

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Aug 2014 at 9:10am
if datepart('d',datefield) IN 1 to 7 then totext(datefield,'MM/01-MM/07') else
if datepart('d',datefield) IN 8 to 14 then totext(datefield,'MM/08-MM/14') else ...

Edited by DBlank - 08 Aug 2014 at 9:12am
IP IP Logged
lawrenceks
Newbie
Newbie


Joined: 07 Aug 2014
Online Status: Offline
Posts: 6
Quote lawrenceks Replybullet Posted: 08 Aug 2014 at 9:32am
Thank you very much for your help.  That works.
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum