Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 322
  • Last Modified:

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
0
loopyadc
Asked:
loopyadc
  • 3
  • 3
  • 3
  • +1
2 Solutions
 
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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 3
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now