Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Sort Date Group by specific dates Post Reply Post New Topic
Author Message
lawrenceks
Newbie
Newbie


Joined: 07 Aug 2014
Online Status: Offline
Posts: 6
Quote lawrenceks Replybullet Topic: Sort Date Group by specific dates
     Posted: 15 Jul 2015 at 5:51am
I need to sort a date group by a specific format. In the group options for a date field, you can choose how you want the section to be printed (by day, week, month, quarter...)

I need the group to be printed by week, but the week MUST be the first 7 days of the month as week 1, days 8-14 as week 2 and so on. Crystal defines a week as Sunday through Saturday, regardless of the dates. I tried to use the following formula as a group sort order: I get "A constant expression is required" error message.

if datepart('d',{rpSxData.DSampled}) IN 1 to 7 then "Week 1" else
if datepart('d',{rpSxData.DSampled}) IN 8 to 14 then "Week 2" else
if datepart('d',{rpSxData.DSampled}) IN 15 to 21 then "Week 3" else
if datepart('d',{rpSxData.DSampled}) IN 22 to 31 then "Week 4"

Is there a way to choose the above formula as the print order?
IP IP Logged
jfdr31
Newbie
Newbie


Joined: 19 Feb 2015
Online Status: Offline
Posts: 9
Quote jfdr31 Replybullet Posted: 15 Jul 2015 at 6:47am
I do something similiar with month when I am trying to get reports done by fiscal year, in the order of October through September. I goto Group Expert, highlight the month, click Options, then I choose the second pull down menu and select in a specific order where I type in the order of the months that I want. Not sure if that will work for your issue but worth a try.
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