Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: How do I sort this? Post Reply Post New Topic
Author Message
nix1016
Groupie
Groupie


Joined: 07 Jun 2010
Online Status: Offline
Posts: 40
Quote nix1016 Replybullet Topic: How do I sort this?
     Posted: 04 Aug 2010 at 11:02pm
I need to sort a group by month & year. Basically the field I sort with is in a date format and I use month() to get the month and then translate that to word so 1= january, 2 = february etc. I then append the year to that.

Now I can't sort by ascending or descending because it's in string format and it would sort alphabetically. I can't sort using specific order either because the year changes and I can't append the year dynamically to the group name. Basically I need the group headers to display something like:

November 2009
December 2009
January 2010
February 2010
etc

How do I go about doing this?

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Aug 2010 at 3:48am
if you group on a date field you can choose the group to be by month and it will sort as you desire
IP IP Logged
nix1016
Groupie
Groupie


Joined: 07 Jun 2010
Online Status: Offline
Posts: 40
Quote nix1016 Replybullet Posted: 05 Aug 2010 at 11:43am
The thing is it has to be string field because the group name is a variable depending on what the user chooses. I.e. they can group by date, or priority or area, etc so I have to convert the date field to a string in order to use it as the group name.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Aug 2010 at 12:07pm

you can still group on the date field and display it as a Name

IP IP Logged
nix1016
Groupie
Groupie


Joined: 07 Jun 2010
Online Status: Offline
Posts: 40
Quote nix1016 Replybullet Posted: 05 Aug 2010 at 1:23pm
I changed the report so that it no longer uses dynamic grouping and I'm using the date as the group header shown in the Month-Year format, however, it is grouping by date rather than month even though it is showing Month, so if I have two records: 01/01/2010 and 02/01/2010, they are showing under 2 different groups both 'January 2010'. How do I put them under the same group?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Aug 2010 at 3:16pm

select the group expert

select the date group
select options
change it from per day to per month
IP IP Logged
nix1016
Groupie
Groupie


Joined: 07 Jun 2010
Online Status: Offline
Posts: 40
Quote nix1016 Replybullet Posted: 05 Aug 2010 at 3:41pm
Great, thanks for that!
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