Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Group Sort Order Formula Post Reply Post New Topic
Author Message
winegard
Newbie
Newbie


Joined: 09 Sep 2009
Online Status: Offline
Posts: 3
Quote winegard Replybullet Topic: Group Sort Order Formula
    Posted: 09 Sep 2009 at 2:08pm
I have a parameter called "Report Type" which gives the user the option of selecting to see the data grouped "By Month", "By Week", "By Day", or "By Hour".
 
I would then like to modify the group so that it correctly groups this data based on the user selected parameter.  I have read you can enter a formula and change the sort order, which I have done... but their must be a way to change the date grouping as well. I have found keywords such as "crGCMonthly" in the technical manual but they do not work.
 
Sample formula...
 
If {?Report Type} = "By Month" then
    crAscendingOrder
Else
   crAscendingOrder
 
------------------------------------------------
 
I think it would be something like...
 
If {?Report Type} = "By Month" then
    crGCMonthly
Else
   crGCWeekly
 
 
 
 
Any help would be appreciated.
 
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 10 Sep 2009 at 7:13am
If {?Report Type} = "By Month" then
 totext({table.field}, "MM/yyyy")
else
  If {?Report Type}= "By Week" then
   //hmm. not sure
  else
    If {?Report Type} = "By Day" then
     totext({table.field}, "MM/dd/yyyy")
    else //, or "By Hour".
     totext({table.field}, "MM/dd/yyyy HH")
 
this should at least give a start.   make the formula and then in the grouping, choose the formula...poof...all done.  Use this method all the time.
 
HTH
IP IP Logged
winegard
Newbie
Newbie


Joined: 09 Sep 2009
Online Status: Offline
Posts: 3
Quote winegard Replybullet Posted: 10 Sep 2009 at 8:43am
Thanks for the help but that formula obviously does not return a value that will be accepted in a Group Sort Order formula.
 
Only work around I've found is to create 4 different groups and 4 different charts and suppress the 3 not selected based on the parameter they choose.
 
It works, just not the best use of computing power. Has to be a way to add in the crGCMonthly.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 11 Sep 2009 at 6:37am

you should post what you want.  You said you wanted a dynamic grouping, you said nothing about group sort order formula.  I use the above and variations of it to dynamically group in dozens of reports.

I do not believe in solving your problem in every way, that is what you are getting paid for, but rather to show a path.  Using the above, you could easily format EVERY instance to be mm/dd/yyyy hh, you would just need to think about it, which is again what you are paid to do, as am I.
 
So getting a bit snippy, is I believe a bit out of line.
 
IP IP Logged
winegard
Newbie
Newbie


Joined: 09 Sep 2009
Online Status: Offline
Posts: 3
Quote winegard Replybullet Posted: 11 Sep 2009 at 7:07am
Originally posted by lockwelle

you should post what you want.  You said you wanted a dynamic grouping, you said nothing about group sort order formula. 

 
The title of this post is "Group Sort Order Formula".
IP IP Logged
Smittles
Newbie
Newbie


Joined: 15 Sep 2010
Online Status: Offline
Posts: 5
Quote Smittles Replybullet Posted: 05 Oct 2010 at 6:21am
Nice, guys. Way to bicker about a problem and ruin Google searches about the actual issue.
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.032 seconds.