Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Dynamic Grouping Post Reply Post New Topic
Author Message
Anubisascends
Newbie
Newbie
Avatar

Joined: 05 Apr 2009
Online Status: Offline
Posts: 15
Quote Anubisascends Replybullet Topic: Dynamic Grouping
     Posted: 05 Apr 2009 at 8:20am
Hello,

I am new to this forum, but have been using Crystal Reports since 8.0.  I want to try the following and was hoping someone could help me.

I have an access database that needs to be reported on.  Wee use a crystal reports viewer that allows us to specify formula values for the selected report.

Can I use a formula to add or remove a group to the report?

If you need more information, please let me know.

Thank you in advance for any help.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Apr 2009 at 2:57pm
Can you give more of a description on exactly what you want to do.
IP IP Logged
Anubisascends
Newbie
Newbie
Avatar

Joined: 05 Apr 2009
Online Status: Offline
Posts: 15
Quote Anubisascends Replybullet Posted: 05 Apr 2009 at 4:24pm
Sure thing.

In the Access Database, there are the following tables that I want to use:

Job_Info
Rooms
Tops

Job_Info has the following structure (truncated for this topic)

ID
JobName
JobDescription
etc.

Rooms has the following structure (truncated for this topic)

RoomID
JobID  (references the Job_Info.ID field)
RoomNumber
RoomName
RoomDescription
etc.

Tops has the following structure (truncated for this topic)

RoomID (references the Rooms.RoomNumber field)
TopName
TopDescription
TopWidthString
TopDepthString
TopThicknessString
etc.

The report needs to be grouped against each Rooms.RoomID.  I want to create a formula field that the user of the report can set to false.  Once that field is set to false, the grouping should automatically turn off.

I am assuming that I may be able to do this with two sub reports, one that has the grouping and one that doesn't.  Will I be able to turn the sub-reports on and off like this?

Thanks.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Apr 2009 at 6:00pm
You could easily conditionally suppress the sub reports based on the user selecting a parameter. Just set up your paramter the way you want for indicating grouping or not (like 1 for grouped 2 for ungrouped).
Create your 2 versions of the reports as sub reports and place each on a seperate header. Go into Section epert and set each to be conditionally suppressed.
suppress formula section1 as : {?parameter}=1
section 2 as: {?parameter}=2
or any other variation of this same process would work.
IP IP Logged
Anubisascends
Newbie
Newbie
Avatar

Joined: 05 Apr 2009
Online Status: Offline
Posts: 15
Quote Anubisascends Replybullet Posted: 06 Apr 2009 at 9:30am
That is essentially what I did.  Here are the steps that I took exactly to get what I wanted:

1) created 2 sub reports (one that was just the line items and another that was grouped)
2) Split the details section into two (a and b)
3) Placed one sub report into 'details a' and the other into 'details b'
4) Linked all the relevant database fields to the two reports
5) Created a new  boolean formula (@GroupByRoom)
6) Set the 'details a' to suppress if @GroupByRoom is true
7) Set the 'details b' to suppress if @GroupByRoom is false

Thanks for you help.  I appreciate it.
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