Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Suppress group headings Post Reply Post New Topic
Author Message
JohnT
Groupie
Groupie
Avatar

Joined: 20 Jan 2008
Online Status: Offline
Posts: 92
Quote JohnT Replybullet Topic: Suppress group headings
     Posted: 20 Jan 2008 at 7:54pm
I have a report that has 2 group headings.  My detail line has a formula to suppress the lines I don't want but if all the lines are suppressed for the group, the group heading still prints.   My data shows:
employee name
employee location
employee salary table
job start date
job end date
employee termination date
 
 My report is to show employees terminated during the year who were in a particular salary table.  Employees can have numerous records as a result of changing jobs or locations.  When an employee is terminated, the termination date is placed in all their records.
 
My report works like this:
Read 3 parameters. (begin date, end date and salary table)
Read in all records where the termination date is between a begin/end date parameter.
Group by location then name.
Find the most recent end date using the maximum function on all records for an employee.  (This is why I have to group by employee)
Suppress the detail lines I don't want using the formula:
  not(end date parameter = max end date and salary table = input parameter salary table).
Suppress the group 2 heading for employee names because the name is in the detail line.
 
When no records are printed for a location, the group heading for the group location still prints.  
 
How can I prevent the location group heading from printing if the report shows no employees for that location ?  
 
Thanks in advance for your help.
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 21 Jan 2008 at 12:42am

Hi,

Go to group heading ,right click Select Format Field,then select  Common Tab ,Click X+2 button for Suppress and enter the following formula
 
ISNULL(Count({Employee.Employee ID}, Employee_Addresses.Country}))
 
 
I have tested with employee ID in Country  you can modify according to your requirements
 
Cheers
Rahul
IP IP Logged
JohnT
Groupie
Groupie
Avatar

Joined: 20 Jan 2008
Online Status: Offline
Posts: 92
Quote JohnT Replybullet Posted: 21 Jan 2008 at 7:34am
Thanks for the response.  I tried the ISNULL(count... ) formula and the heading is still printing.  I tried a count formula in a variable and printed in in the report.  It looks like the (Count({employee id},{employee location})) formula shows the number of records in that group.  It doesn't show the number of records printed in that group as a result of the suppression formula.  If no records are printed, I want to suppress the group heading for location.  I'll keep after it !
Thanks
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 21 Jan 2008 at 7:52am
Hi Try doing this
 
What i did was
 
created text object and placed the group name for Employee_Addresses.Country  in it .
 
then right click the text object 
 
format text
 
x+2 suppress and enter the fomula below
count({Employee.Employee ID},{Employee_Addresses.Country}) = 0
 
I had two groups employee_addresss_country  and last name
 
so it list the details for employees grouped by country and then lastname
 
it
 
suppressed my group heading where the count of employee id was 0
 
 
Hope that helps hope this time i understood what you after ....
 
cheers
rahul
IP IP Logged
JohnT
Groupie
Groupie
Avatar

Joined: 20 Jan 2008
Online Status: Offline
Posts: 92
Quote JohnT Replybullet Posted: 21 Jan 2008 at 12:17pm
I thought I followed your steps exactly but still no luck.  It seems that the count({employee ID},{employee location}) formula always returns the total number of records in the group and not the number of lines that are printed.  (I have a suppress formula on my detail)
 
I am going to try a few other things but I am running out of ideas.  I have checked other Crystal sites and can't find any postings that are similar to my problem.
 
Thanks,
John
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 22 Jan 2008 at 12:43am
Hi John,
 
Yes you are correct ,I am bit confused what do you want to suppress is the detail lines or Group Headings...because if you use the forumla that i have listed will suppress the group heading Location i.e Country in my report  ,I Have not tried suppressing lines.....
 
Cheers
Rahul
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 22 Jan 2008 at 6:08am
Rahul,

The basic problem here is that there are records in the group.  So, the Count will return a positive number.  But, they are suppressed.  So, it looks like an empty group when printed.


John,

The simplest solution is to create a formula in your details section.  Set it up using the same formula you used to suppress the rows.  Have it return 0 if the suppress condition is true, and 1 if it is false.  In your group header, set a suppress condition such that the header is suppressed if the sum of that formula is 0 (in which case, there is no un-suppressed row in the group).


IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum