Link to home
Start Free TrialLog in
Avatar of hcshosting
hcshostingFlag for Australia

asked on

Crystal Reports: How to suppress group header based on formula in footer

We have a report that includes variables to calculate an adjusted total.
The problem we have is that we need to suppress a group header where the value of a formula (including a variable) in the group footer is zero.

The setup of the report is as follows:

In a group header (Group 1 - Employee) is the folllowing formula called Declare Achieved Target:

WhilePrintingRecords;
NumberVar AchievedTotal;
if not InRepeatedGroupHeader then
AchievedTotal := 0
else if InRepeatedGroupHeader then
AchievedTotal := AchievedTotal



Then in the next group header (Group 2 -Competency) is the following formula called Calc Achieved Target:

WhilePrintingRecords;
NumberVar AchievedTotal;
AchievedTotal := AchievedTotal + {@Adjusted Achieved}


Then in the footer for Group 1 (Employee) is the following formula called Display Achieved Target:

WhilePrintingRecords;
NumberVar AchievedTotal;
AchievedTotal;

What we need to have happen is that if the value of the 'Display Achieved Target' is zero the Group header and group footer for Group 1 Employee need to be suppressed.

We can suppress the footer record by including the following in the suppress option against the footer

If {@Display Gap} = 0 then true else false

But this doesnt work for the header. I understand that this is because of the order in which Crystal processes but we need to find a way of suppresses the header row?

Any ideas if this can be done? We are using Crystal Reports v9.

thanks
Avatar of kbens0n
kbens0n

What is {@Display Gap} ?

Spykair
Avatar of hcshosting

ASKER

oops Sorry typo/mistake @display gap should be @Display Achieved Target
Go to your section expert for the Group Header1 -> click on the 'X+2' next to "Suppress" and enter this:
{@Display Achieved Target} = 0

It should work.

Hth,
Spykair
Good ol' experts-exchange.com Database for Crystal Reports serves us well, sometimes ;-)
hi Spykair,

Unfortunately, adding {@Display Achieved Target} = 0 to the groupheader suppress hasnt worked.. the header still appears in the report.


Try:
{@Display Achieved Target} = 0
or {@Display Achieved Target} isnull

Spykair
Spykair, I think you meant this?

IsNull({@Display Achieved Target})
or {@Display Achieved Target} = 0

--
Outin
Oops, ja. Thanks Outin.
Hi,

ive tried isnull(@Displayed Achieved Target}) and the header is still displaying..

Just to be sure:
This

IsNull({@Display Achieved Target})
or {@Display Achieved Target} = 0

is 1 complete formula, not a list of possible options...

--
Outin
Are you wanting to display the detail even in the GH1 / GF1 is syuppressed here?

DAVE SMITH
ASKER CERTIFIED SOLUTION
Avatar of wykabryan
wykabryan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Dave Smith,

In the case where we want to suppress the header all the detail records for the group would be suppressed and the footer would be suppressed.

Hi Outn, I've tried it as all combinations and the header is still appearing.

I'll see if the beforeprintrecord function works and advise

thanks for all your suggestions
Hmm, well I'd be inclined twoards total group suppression if this is the case.  Have you approached it from angle yet?

DAVE SMITH
Hi,

I've tried adding

If {@Display Gap} = 0 then true else false

to the group select but the formula cant be saved
message is 'This formula cannot be used because it must be evaluated later.'

I then tried
Adding the following to the actual group header record

whileprintingrecords;
if {@Display Gap}= 0 then true else false

and this works. the header record no longer appears.

thank you for all your help

I still cannot see how your stated conclusion will apply to the Group as a whole or even for the Group Header:
     whileprintingrecords;
     if {@Display Gap}= 0 then true else false

I have tried the "whileprintingrecords;" state in a similar example, and it will always analyze differently for the Group Header and its Footer.  The Header analysis is based on the "previous" Group's result, not on the "Current" Group.

Is there a "working" solution for this issue?

JR