R – Crystal Reports: How to hide a group in a grouped report

crystal-reportsgrouping

I have a report grouped by Class1, Class2, Class3, ShortDesc, CreateDate.

It looks like this:

Class1 Class2 Class3 <- This is GroupHeader1 (I did it this, way to save space)

ShortDesc – test1 <- This is GroupHeader4

27.07.2009 10:00 <- This is GroupHeader5

Ticket-ID AssignedGroup
1 <- this is Detail
2
3

27.07.2009 11:00 <- This is GroupHeader5
Ticket-ID AssignedGroup
4 <- this is Detail

27.07.2009 12:00 <- This is GroupHeader5
Ticket-ID AssignedGroup
5
6

ShortDesc – test2

29.07.2009 10:00 <- This is GroupHeader5
Ticket-ID AssignedGroup
9 <- this is Detail
11
14

29.07.2009 11:00 <- This is GroupHeader5
Ticket-ID AssignedGroup
23 <- this is Detail
28

29.07.2009 12:00 <- This is GroupHeader5
Ticket-ID AssignedGroup
45 <- this is Detail

Now I want to hide the Details, if there is just one ticket in GroupHeader5

This one is acctualy easy. I've said if Count ({TroubleTicket.CreateDate}, {TroubleTicket.CreateDate}, "by hour") = 1 the Hide.

So let move on.

Now I want to hide GroupHeader4, but only if all GroupHeader5 have only one ticket. I tried for hours, but I don't know how to bite this one.

Best Answer

Create a running total that counts records returned in your group, and have it reset on each change of group. How you do this depends on the version of CR you are using, but to my knowledge it is possible in about all of them. After that, you put the following in your suppression formula for GroupHeader4:

// of course you would change '=' to '<='
// if you also want it to hide on 0

{#RunningTotalThatCountsRecords}=1;

This should work for most versions of Crystal Reports.

Related Topic