Tips and Tricks
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Tips and Tricks
Message Icon Topic: Tip: How to do flexible grouping Post Reply Post New Topic
Author Message
dbodell
Groupie
Groupie
Avatar

Joined: 08 Nov 2011
Location: United States
Online Status: Offline
Posts: 53
Quote dbodell Replybullet Topic: Tip: How to do flexible grouping
    Posted: 30 Apr 2012 at 5:45am
One of the most useful things that I do when developing summary reports is to allow the user to select how they want the data summarized when they run the report. So, for example, I provide them a parameter for Group1, a parameter for Group2 and a parameter for Group3. In Group1 they have certain predefined choices (in my world they are things like Location, Department, Physician, Insurance) or "None" in case they don't want to use that summary level. I provide similar options for groups 2 and 3. In this manner the user can choose to run the report one time by Location, then Department and then Physician. Next time they can run it by Department / Physician / Insurance. The one report allows them complete flexibility in how to summarize.
 
It is relatively easy to set this up. First of all, as I outlined above, you will create multiple group level parameters: Group1, Group2 and Group3 for my purposes. These will be string parameters that are static. I will enter in the list of possible choices that you want them to have in the value list, putting "None" as the first value. For my example, I would enter values like "Loc","Dept", "Phys", etc. In the description field for the value I would enter "Visit Location", "Visit Department" and "Visit Doctor".
 
Once I've done this for all three Group parameters, I need to set up 3 formulas: one for each group. I will use these formula fields to actually group my data. My formula for Group1 would be something like:
 
if {?Group1} = "None" then "No Grouping" else
if {?Group1} = "Loc" then {MyTable.LocID} + {MyTable.LocationName} else
if {?Group1} = "Dept" then {MyTable.DeptID} + {MyTable.DeptName} else
if {?Group1} = "Phys" then {MyTable.PhysID} + {MyTable.PhysicianName} else
"No Grouping"
 
After I have a formula field set up for each possible grouping, I set my report groupings to be Group1/Group2/Group3 in that order.
Finally I set the group headers and footers to be suppressed if the value for that level of grouping is "None". This is usually only necessary on Group3 but I do it for Group2 as well.
 
Have fun! If you have any questions don't hesitate to ask.


Edited by dbodell - 30 Apr 2012 at 5:47am
Thanks,
D. Bodell
IP IP Logged
varunseo143
Newbie
Newbie


Joined: 07 May 2012
Location: India
Online Status: Offline
Posts: 2
Quote varunseo143 Replybullet Posted: 07 May 2012 at 7:37pm
We would like to do flexible grouping as a grade level for math. There are 5 teachers. There is some dispute about the best way to do this. Has anyone tried it wioth 5, have ideas, or research to back up the idea?
We really don't want to try to teach 100 different kids or the kids to have 5 different teachers.
Thanks.


Edited by BrianBischof - 08 May 2012 at 8:48am
IP IP Logged
dbodell
Groupie
Groupie
Avatar

Joined: 08 Nov 2011
Location: United States
Online Status: Offline
Posts: 53
Quote dbodell Replybullet Posted: 08 May 2012 at 2:49am
Hi. I guess I don't really understand what you mean by having 5 levels and 5 teachers. The principles for flexible grouping would be the same for 5 levels as it would be for 3 levels. In my example I could have grouped by
 
Location \ Physician \ Insurance
 
with Location being the top level of summary, Physician being the second level of summary (within location) and Insurance being the third level (within physicial within location).  What kinds of groupings do you want to have on your report and what would the choices be? What does having 5 teachers have to do with grouping the report or teaching how to do the report?
Thanks,
D. Bodell
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.016 seconds.