Solved

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

Posted on 2006-07-04
18
25,413 Views
Last Modified: 2008-06-03
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
0
Comment
Question by:hcshosting
  • 5
  • 4
  • 2
  • +4
18 Comments
 
LVL 6

Expert Comment

by:kbens0n
ID: 17040146
Does the "Accepted Answer" for this previous inquiry have any applicability?

http://www.experts-exchange.com/Databases/Crystal_Reports/Q_21460758.html
0
 
LVL 10

Expert Comment

by:Spykair
ID: 17040229
What is {@Display Gap} ?

Spykair
0
 

Author Comment

by:hcshosting
ID: 17040267
oops Sorry typo/mistake @display gap should be @Display Achieved Target
0
 
LVL 10

Expert Comment

by:Spykair
ID: 17040282
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
0
 
LVL 6

Expert Comment

by:kbens0n
ID: 17040297
Good ol' experts-exchange.com Database for Crystal Reports serves us well, sometimes ;-)
0
 

Author Comment

by:hcshosting
ID: 17040358
hi Spykair,

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


0
 
LVL 10

Expert Comment

by:Spykair
ID: 17040381
Try:
{@Display Achieved Target} = 0
or {@Display Achieved Target} isnull

Spykair
0
 
LVL 9

Expert Comment

by:Outin
ID: 17040480
Spykair, I think you meant this?

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

--
Outin
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 10

Expert Comment

by:Spykair
ID: 17040487
Oops, ja. Thanks Outin.
0
 

Author Comment

by:hcshosting
ID: 17040512
Hi,

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

0
 
LVL 9

Expert Comment

by:Outin
ID: 17040594
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
0
 
LVL 1

Expert Comment

by:davetheravesmith
ID: 17045135
Are you wanting to display the detail even in the GH1 / GF1 is syuppressed here?

DAVE SMITH
0
 
LVL 16

Accepted Solution

by:
wykabryan earned 500 total points
ID: 17045590
I am not sure you can suppress the header based on the footers information because of the sequence that CR runs.  The header will always run before the footer.  Of course, you can try the beforeprintrecord function or provided your footer will lead into the next header.  I am not even 50% positive on this.  Will stay tuned.
0
 

Author Comment

by:hcshosting
ID: 17047335
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
0
 
LVL 1

Expert Comment

by:davetheravesmith
ID: 17048814
Hmm, well I'd be inclined twoards total group suppression if this is the case.  Have you approached it from angle yet?

DAVE SMITH
0
 

Author Comment

by:hcshosting
ID: 17089674
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

0
 

Expert Comment

by:JuanAR
ID: 20577243
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
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now