Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Grouping based on a parameter Post Reply Post New Topic
Author Message
p0pcan
Newbie
Newbie


Joined: 06 Sep 2011
Online Status: Offline
Posts: 24
Quote p0pcan Replybullet Topic: Grouping based on a parameter
     Posted: 31 Jan 2012 at 6:10am
Hello, I am back :)
So I was just wondering if there was a way to group a report based on a parameter?  For instance, I have a report that give the user a choice to group info (group id, customer, category, and product) and I only want the report to group info based on what they choose.  So if they choose group id and category, I dont want the report to group by customer and product as well.  Does this make sense??  I have it right suppressing the groups based on their selection but the report is still performing the grouping (just not displaying it)

Is there a formula or something I can use to group based on the user's selection?

Thanks
Brandon
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 31 Jan 2012 at 6:57am
try
go to section expert click x-2 button next to suppress(with no drill down)
and put an appropriate formula like
isnull(?parameter)
 for each group like
IP IP Logged
p0pcan
Newbie
Newbie


Joined: 06 Sep 2011
Online Status: Offline
Posts: 24
Quote p0pcan Replybullet Posted: 31 Jan 2012 at 7:32am
Thanks for the reply.  That is what I already have setup, it is just suppressing the info but still performing the grouping...if that makes sense.
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 01 Feb 2012 at 1:13am
Make formulae for each group/parameter as follows (assumes your parameters are boolean (ie group by customer true/false);
 
GROUP 1
if {?group_id} = True then {table.group_id} else ""
 
GROUP 2
if {?customer} = True then {table.customer} else ""
 
GROUP 3
if {?category} = True then {table.category} else ""
 
GROUP 4
if {?product} = True then {table.product} else ""
 
Then create your groups on the relevant formulas rather than the actual table fields - eg your first group would be on formula {@Group 1} rather than {table.group_id}
 
If you need any more help let me know.
 
Regards,
Ryan.


Edited by rkrowland - 01 Feb 2012 at 1:15am
IP IP Logged
p0pcan
Newbie
Newbie


Joined: 06 Sep 2011
Online Status: Offline
Posts: 24
Quote p0pcan Replybullet Posted: 01 Feb 2012 at 5:05am
That is fantastic...everything worked when I changed the group to what you said...thats why I love coming here for help...thank you so much.
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