Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I suppress group footer in a drill down? 1

Status
Not open for further replies.

aaarthi

Programmer
Jun 2, 2003
21
US
I use Crystal 8.5. I have a report with 3 levels of groups.
Each group footer has the summary values for the field in the "Details" section.

Now, when I drill down from Group 1 to Group2, the sumamry in the group 1 footer also appears in the drill down page. Is there some way to suppress the group 1 footer in the group 2 page? CR 9.0 has drilldowmlevel() to check what level it is and then suppress the section. But how would I do that in CR 8.5?

 
This is a rather complex answer I stumbled across a while back. If someone has a cleaner approach, I'd love to see it.

Anyway, here's the approach. It's based on the fact that variables calculated during the 2nd pass (i.e., using the WhilePrintingRecords print state) will evaluate differently inside a drill down tab then in the main report if the formula is initialized in a group higher than the group being drilled into.

So, since you are drilling from Group 1 to Group 2, we actually need to create a dummy group that will be the highest group in the report. If you have a field that is a constant value in all records, you could use that. Otherwise, create a formula such as:


Formula Report:
---------------
If {ado.CompanyName} = {ado.CompanyName} then
"Report"
Else
""

(What is important about the formula is that Crystal must think it is a recurring value; otherwise it won't let you group on it) Add a group, selecting the above formula as the field to group on and move the group so it is group 1. You can suppress this group after you create it. Now for the rest:


Create the following formula:

Formula InDrillDown:
--------------------
WhilePrintingRecords;
Global NumberVar InDrillDown := InDrillDown + 1;

Place this formula in the group header above the first group that appears in the drill down. In your case, I believe that would be group 1 (the dummy group). You'll probably want to suppress the display of this formula.

Create another formula and place it in the group 1 footer (or whatever section you are drilling into):

Formula CheckDrillDown:
-----------------------
WhilePrintingRecords;
global NumberVar InDrillDown

Now, go to the section expert and select the footer you wish to suppress (group footer 1). Under the conditional formula for the suppress option, enter the following:

{@CheckDrillDown} = 0

This approach works because inside the main report, the variable InDrillDown alway evaluates to > 0 for any section in the report (well, not the report header, at least the way we're using it). But in the drill down, it is never initialized, so it evaluates to 0.
 
Wow!!! This worked out wonderfull. Thanks a lot FVTrainer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top