Ignore grouping level with a parameter

Hi everyone,

I'm pretty new to Crystal and having a grouping issue.  

If I had 3 parameters for grouping (three levels) and wanted to give the user flexibility to group on only 1 or two levels (therefore selecting '*' from a list in the parameters.

I was wondering if it would be possible then to jump from the 2nd grouping level, right down to the detail levels as they wouldn't want to see the same records in the 3rd level that were in the 2nd level (essentially skipping the 3rd grouping level)

This is the code I've currently got in my parameter for grouping.
??? Is how I imagine the code would look like:

Select {?Group1Parameter}
???    Case "*": NoGrouping
    Case "Territory": {V2PS_Order_Lines_w_Mapping.Territory}
    Case "Order Type": {V2PS_Order_Lines_w_Mapping.Order_Type}
    Case "Product": {V2PS_Order_Lines_w_Mapping.T_PRODUCT_MAPPING}
    Case "Quarter": {V2PS_Order_Lines_w_Mapping.QuarterDisplay}

Thanks
Chris
loopyadcAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
Where are you wanting to add this code?

Groups in Crystal have headers and footers which you will need to suppress.  Other than that they are essentially sort fields.

I don't believe from the report you can drop a group.  It can be done from an application.
If you do this from Crystal you may need to use the primary Key field as the group.

mlmcc
0
loopyadcAuthor Commented:
I currently have that code in my parameter values so once the user can dynamically select what they want to group by, and now I want to add the functionality to allow them not to have to use the grouping functionality if they don't want to.

If I could suppress the headers and footers without excluding any records at that grouping level it would be perfect.

I could use the Account_Id field (if parameter = "*" then group by id - none are null) if I could then hide the header and footer and show the detail?
0
mlmccCommented:
To hide a header or footer

Open the report
Click FORMAT --> FORMAT SECTION
Select the section
Click the FORMULA BUTTON to the right of SUPPRESS
Enter a formula that is TRUE when you wish to suppress
  {?Group1Parameter} = "*"

mlmcc
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

bdreed35Commented:
You need to create 3 formulas to group on.

Each formula should look at the paramater like in your first post, except you should return an empty string if they choose "*":

//@Group1
Select {?Group1Parameter}
    Case "*": ""
    Case "Territory": {V2PS_Order_Lines_w_Mapping.Territory}
    Case "Order Type": {V2PS_Order_Lines_w_Mapping.Order_Type}
    Case "Product": {V2PS_Order_Lines_w_Mapping.T_PRODUCT_MAPPING}
    Case "Quarter": {V2PS_Order_Lines_w_Mapping.QuarterDisplay}

Also, all cases need to return the same datatype.

So create 2 more formulas called Group2, and Group3.
Base each grouping off of the each of the three formulas.
Next, open the section expert under the report menu.
Highlight Group Header 1 and and then click the X+2 button to the right of Suppress (No Drill Down).
In the editor, enter the following logic:

    {?Group1Parameter} = "*"

Save and Close.
Highlight Group Footer 1 and enter the same formula in the same place.
Repeat the above steps for Group 2 Header/Footer, and Group 3 Header/Footer using the corresponding parameter in the formula.
0
loopyadcAuthor Commented:
Thanks , I can now suppress the drill down, but I can't get down to my final detail level which I still want to be able to get to?

Essentially I'm trying to skip out one of the grouping levels if the user doesn't want to see it and then get straight to the detail.  If I suppress one of the drill down levels it won't let me go any further.

Is it possible to do this and still get to the detail level?

Cheers
Chris
0
GJParkerCommented:
You can't control the drill down functionality with a formula. If you hide any of the group sections you can still double click in the blank space to drill down but you can't miss out the group and go to the next level.

Gary
0
bdreed35Commented:
What version of Crystal are you using?  
This is possible with 9 and above, but not with 8.5 or below.
0
loopyadcAuthor Commented:
I'm using CR11 Dev
0
bdreed35Commented:
Ok, then give this a shot.

Remove any "Hide Drill Down OK" from any of the group header/footer or details sections.
Now, from the Section Expert, you need set some conditional suppression formulas for the group sections and details section.
For each of the following sections that I list, you will need to highlight that section in the Section Expert, then click the X+2 button to the right of "Suppress (No Drill Down)" and enter the code that I provide.
You may need to alter the spelling of you parameters if need be.
BTW, I am assuming that if an "*" is chosen in Group1, then it will ignore the rest of the parameters and assume that they don't want it grouped at all.

Group Header 1 and Group Footer 1:
    {?Group1Parameter} = "*"

Group Header 2 and Group Footer 2:
    ({?Group1Parameter} = "*" or {?Group2Parameter} = "*") or DrillDownGroupLevel < 1

Group Header 3 and Group Footer 3:
    ({?Group1Parameter} = "*" or {?Group2Parameter} = "*" or {?Group3Parameter} = "*") or DrillDownGroupLevel < 2

Details:
    (DrillDownGroupLevel = 0 and {?Group1Parameter} <> "*") or
    (DrillDownGroupLevel = 1 and {?Group2Parameter} <> "*") or
    (DrillDownGroupLevel = 2 and {?Group3Parameter} <> "*")

Save and Close and Test.
0
mlmccCommented:
Glad i could help

mlmcc
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.