how to suppress group header 1 if group header 2 is not showing anything - crystal-reports

please help this noob on suppressing a group header 1 if group footer 2 is not displaying anything might be because there are no records to display, or all records are suppressed. I have a suppressed condition on group footer 2
IACode Group header #1 [Description]
ICode Group header #2
Details | itemcode | date | aantal | qty (supressed)
ICode Group footer #2| itemcode | date | (SUM)aantal | SUM(qty)
IACode Group footer *1
sample result
ABC Company (no data)
Helios Corporation
xx1001 09/10/2022 200 100
xy2091 09/22/2022 125 099
Super Tech Company
yy2222 01/10/2021 100 234 (suppressed as per suppress condition)
it should only show
Helios Corporation
xx1001 09/10/2022 200 100
xy2091 09/22/2022 125 099
current suppression condition # x+2 of Group Footer #2
ISNULL({qty}) OR {#datum} > 90 OR {aantal} = 0 (this is the only formula for the suppression).
and for the formula datum is date('9/1/2022') - {table.date}.

You have to evaluate the fields within Group Header 2 while printing Group Header 1.
So imagine a Crystal Report for inventory items. If I group my inventory items first on ITEMNO, and then on REVISION, I will have a report with ITEMNO in Group Header 1, and REVISION in Group Header 2. Then the details sections can contain other fields such as ONHAND_QTY, PRICE, STD_COST, ect...
Not every item will have a REVISION, so there will be some NULL values in this field. If I wanted to suppress Group Header 1 when Group Header 2 contains no data, its easily done when the fields within Group Header 2 all contain NULL values. To do this I simply use the following formula in the Suppress property of the Group Header 1 section.
ISNULL(GroupName ({ARINVT.REVISION}))
If the REVISION field is NULL, this formula returns TRUE and suppresses Group Header 1. If you have multiple fields in Group Header 2, you will need to test each field for NULL values. Now the formula becomes:
ISNULL(GroupName ({ARINVT.REVISION})) & ISNULL(OTHER_FIELD_1) & ISNULL(OTHER_FIELD_2)...
Now the tricky part comes into play when you need to suppress Group Header 1 because Group Header 2's fields have all been suppressed and do not contain NULL values. In order to satisfy this requirement, you will need to create an aggregate of all of the formulas that suppress the fields in Group Header 2. And then use that same logic to suppress Group Header 1. Its hard to provide much of an example of this without full knowledge of how you are suppressing fields within Group Header 2. I'm willing to give it a try though if you can share all of the formulas used to suppress the fields in Group Header 2.
Now you need to combine the formula for supressing Group Header 1 when all the fields in Group Header 2 are NULL with the aggregate of the formulas used to suppress fields within Group Header 2. This would roughly look like this:
ISNULL(GroupName ({ARINVT.REVISION})) or [aggregate formula goes here]
This formula should then return a value of TRUE if all of the fields are NULL or if all of the fields are suppressed within Group Header 2.

Related

Crystal reports: how to conditionally suppress sections

I am having difficulty suppressing a group header if another group header is blank/suppressed.
Originally I had a layout as follows:
Group Header a - contains client details
Group Header b - contains a subreport that showed details of the incoming calls from client that were received in the last 24 hours.
If the sub report in group header b was blank (because no calls had been received in the last 24 hours), my report was still showing the client details in group header a.
I can suppress the group header b section if the subreport is blank, but cannot work out how to suppress group header a if group header b is blank/suppressed.
After reading various other discussions, I understood that if you want to suppress a section when a subreport is blank, then the subreport would need to be in a section before the section you want to suppress.
So, I changed my layout as follows:
Group Header a - contains sub report showing details of calls in last 24 hours (sub report is suppressed if blank, and group header a is suppressed if blank)
Group Header b - contains client details
Group Header c - contains same subreport showing calls received in last 24 hours
So what I now need to work out is, how do I suppress group header b and c if group header a is suppressed?!
Any help would be greatfully received.
You will need to check record count of sub report, if it is zero then suppress the group using conditional suppress formula. So basically in your group query somewhere you must have field which keeps the count of records in sub report.
Right Click on section
Section Expert
Suppress No Drill
Click x-2 formula editor
if {count} = 0 then true else false
Where {count} is the field having total records for that group
Hope this helps you!

Is it possible to suppress a group header based on various conditions in details?

I have report with a group 1 and group 2. For formatting purposes group 2 header and details are suppress and all information is presented in the group 2 footer. I have set up the report to suppress the group 2 footer if a certain condition is met, The means that sometimes the entire section under the group 1 header is blank and I want to suppress it.
Here is how it is set up
Group 1 - Employee
Group 2 - Client (suppressed)
Details (suppressed)
Client name field1 field 2 field 3 field 4
For fields 1-4 the are possible returns of "Draft", "Final" and null. I'm only looking for "Draft" and null values.
So how I've set up the group 2 footer is to just return the client name and a formula summing up the values of all four fields {#draft}
if {#divDraft} + {#convoDraft} + {#yearDraft} + {#rovDraft} >= 1 then "Draft"
else if {#divFinal} + {#convoFinal} + {#yearFinal} + {#rovFinal} >= 1 then "Final"
else " "
I then suppress the footer based upon {#draft} returning "final"
Is possible to suppress the group 1 header if every client in that group has either all four fields returned as null or at least one returned as draft?
I tried running a subreport and then placing that and a shared variable in the group 1 header but that didn't work right
WhilePrintingRecords;
Shared NumberVar totalSuppress;
Global NumberVar suppression;
suppression := Shared NumberVar totalSuppress;
The {#totalSuppress} formula in the shared report added the times at least one "draft" was returned with the number of times all four fields were null. I placed that in the footer of the subreport and then {#suppression} in the main report group header.
What I got was a pattern where the first group header was returned 0.00 where it had 4 results and 4.00 in the group footer. Then the next group had 4.00 in the group header where it had 1 result and 1.00 in the group footer. And the next one had 1.00 in the group header and so on.
I tried to do a formula to reset the variable with each group header. So I wrote
Global NumberVar suppression;
suppression := 0
But all that did was return 0.00's in the group header.
Any other ideas would be welcome.
RE: Tried new formula
if {sales_div.draft_pend_approv_Value} = "Draft" or {sales_div.draft_pend_approv_Value} = "Pending Approval"
or {convoSales_200.pending_approval_Value} = "Draft" or {rov_client.pend_draft_Value} = "Draft"
or {yearly_sales.draft_pend_Value} = "Draft") then 1
else if isnull({sales_div.draft_pend_approv_Value}) and
isnull({convoSales_200.pending_approval_Value}) and isnull({rov_client.pend_draft_Value})
and isnull({yearly_sales.draft_pend_Value})
then 1
else 0
If I understand correctly, you're trying to use the result of a Running Total Field to suppress a header - which won't work as the running total is only calculated in the footer.
You can try a different approach. Make a Formula Field which will go into your Details section. It should simply check if that row is the kind that you want to show, something like:
if (isnull({field1}) or isnull({field2}) or ... or {field1} = 'Draft' or {field2} = 'Draft' ...)
then 1 else 0
Then in the Group Header #1, in Section Expert, inside the Suppress formula put
sum({#check},{Employee})=0
where {#check} is that formula field and {Employee} is the field on which Group 1 is created

Crystal Reports 2008: Suppress Group Header when details are suppressed

I have a report that currently displays data in the following format:
GROUP HEADER
January Meter Number Name Class Facility ...
...
December MeterNumber Name Class Facility ...
GROUP HEADER
January Meter Number Name Class Facility ...
...
December MeterNumber Name Class Facility ...
I have a conditional suppression formula on the details lines that will suppress a record if one of the fields values is higher than a specific value. Everything works great if I suppress the Group Header line, but I just get a long list of the records
that are not supposed to be suppressed. I would like to leave the Group Header visible so the report is easier to read. The problem is that when I add the conditional suppression formula to the Group Header line, it only looks at the first record in the group. If that record is suppressed, then so is the Group Header, but there may be 3 months worth of records that are not supposed to be suppressed so I would still like the Group Header to display. Instead what I get is the following:
March 10003 Name Class Facility ... //Notice no Group Header
April 10003 Name Class Facility ...
December 10003 Name Class Facility ...
Group Header
January 10004 Name Class Facility ...
March 10004 Name Class Facility ...
February 10005 Name Class Facility ... //Notice no Group Header
March 10005 Name Class Facility ...
Due to the January month being suppressed for meter number 10003 and 10005, the Group Header is also suppressed. I tried placing the Group Header on the details line and that works in the since that it prints the Group Header on every line but then I format that field and suppress duplicates and it does the same thing all over again. It only displays those Group Headers where the January record is not suppressed. This wouldn't be such a big deal but I am dealing with 1000+ records after the suppression.
I have searched for two days for a solution to no avail. Is there any way to look at all records in a group instead of just the first record when it comes to suppressing?
EDIT: For those questions as to why I need to suppress the Group Header when all of the details in that meter are already suppressed it's because if I don't then I get the following:
10003
10004
January 10004 Name Class Facility ...
March 10004 Name Class Facility ...
10005
February 10005 Name Class Facility ...
March 10005 Name Class Facility ...
10006
10007
10008...
In other words, I will get a few pages of just group headers before I see one with actual details.
For the sake of illustration, I'm going to assume that the logic to suppress your Details section is contained in the formula {#SuppressDetails?}. Now, create a new formula that outputs a 1 when the section is suppressed and a 0 otherwise:
if {#SuppressDetails?} then 1 else 0
Place this new formula in the Details section and suppress it. Now, create your Group Header suppression formula such that it compares the number of suppressed Details sections to the total number of records in that group (that is, the {table.MeterNumber} group):
count({#SuppressDetails?},{table.MeterNumber}) = sum({SuppressDetails?},{table.MeterNumber})
I actually found my own way to do this which I now prefer. It's very similar to the one #ryan posted.
I first created a formula field that returns a 1 when the condition is met and I set the condition to the same condition for the detail level suppression. I put that field on the detail level and I suppressed it.
I then created a summary field that sums up that field over the group. And put that field in the group summary and suppressed that too. I then added a suppression rule to the group that said if that summary field is less than 1 then suppress the group summary too.
Viola

Crystal Reports: How to suppress all records in group if ONE based off the value of 1 field

I have a report which lists all employee timesheets (grouped). Each employee will have a record for each day (5 records in total) per group. I want to suppress ALL records for a employee if ANY of the 5 records has a value in a particular field (called "uniqueAttachID").
Basically, if the "uniqueAttachId" is blank, it tells me that the record does not have an attachment and I want to see all employees where this is the case. The attachment can be added to ANY of the 5 records therefore, if ANY of the records HAS data is this field, then I want the whole section of the group suppressed.
You can use below trick to achieve your requirement,
1] create a summary on uniqueattachedID across the group. This summary will give you sum of uniqueattachedID column. Suppress this summary.
2] Now go to the Section Expert of the group. Write formula for Suppress.
3] In formula you will write
if summary column (select this from reports field) > 0 then true
else false
I hope this helps!
If you want to suppress ALL records (Group and Detail), you will have to go into Section Expert, and in the suppress formula for each section of your report that you want to suppress, you enter
uniqueAttachID <> ""
That will suppress each section if uniqueAttachID has a value. You may need to adjust the formula if uniqueAttachID is a numeric field.

Crystal reports - running total for specific groups

I have 4 groups and I only wanted to have running totals for 2 of them and show the total after the second group. Is there a way to do this?
Group1
DetailsA
records...
Group2
DetailsA
records...
TOTAL - SUM(records)
Group3
DetailsA
records...
Group4
DetailsA
records....
There are a couple of ways of doing this:
(1) Set up a running total to sum the appropriate field - add it to a group footing section which is suppressed where the group is not group2.
or
(2) Add a higher level of grouping on a formula set to 1 for the existing groups 1 and 2, and as 2 for groups 3 and 4, then add a sum of the appropriate field to the group footing section for the formula group (which should be suppressed where the formula is not 1). To do so:
add a new formula field called TopGroup (for example).
give it a formula like:
if {TableName.GroupField} = Group1 or {TableName.GroupField} = Group2 then 1 else 2 (substituting actual Group1 and Group2 values as appropriate).
Insert a new group on TopGroup. You will probably find that this is now the lowest level of grouping - open the Group Expert to make it the top level of grouping.
Right-click on your new Group Header #1 and select Suppress.
Drag and drop the field you want to sum into your new Group Footer #1. Right-click on it in the footer and select Insert > Summary... , select the appropriate summary operation (probably Sum) and Summary Location as Group #1, then click OK.
Drag the new summary field off the top of the field it summarised in the Group Footer #1 section, then replace the unsummarised data field with an appropriate text field - eg. Total: .
Enter the Section Expert, and set the Group Footer #1 to be conditionally suppressed where {#TopGroup} <> 1 . If you now preview your report, you should see the desired total between the end of Group2 and the start of Group3.
If it turns out you are likely to need to display the running total elsewhere in the report then I would suggest the first method, otherwise I personally would prefer the second.