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.
Related
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.
I am writing a report on Crystal Reports 2013. I'm doing multiple groupings on the report and basically, I want a field to be displayed on the first instance of the second group.
Below illustrates what I'm trying to do:
Group 1 a
Group 2 a
Display
Group 2 b
Not Display
Group 2 c
Not Display
Group 1 b
Group 2 a
Display
Group 2 b
Not Display
etc…
Any ideas on how this can be done?
Put this in the suppresion-formula of the field
(Replace {Table.FirstGroupCol} with the column you used to group Group1:
Not (OnFirstRecord Or (Previous({Table.FirstGroupCol})<>{Table.FirstGroupCol}))
This will only display the field on the first record or if the previous value of the column used for Group 1 is different from the current one.
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
I have a report where each Group has many records. In these records I have a Running Total that returns True if the fields text matches a certain criteria using the Max type - so one or more matches = True. This is located at the bottom of each group. I now need to count how many groups have a True - so it's like a Running Total of a Running Total - which is not allowed so how do I wire this up? Other ideas for getting this count would be entertained. Thanks for your help...
Layout:
Record(Group Header)
True(function)
True(function)
False(function)
{1}(Group Footer)
Record(Group Header)
False(function)
False(function)
{0}(Group Footer)
{total}(Page Footer)
Ok, here is one way of doing this. It may seem counterintuitive, but it works. Create a formula "max". The content of that formula is:
if {criteria} = true then 1
else 0
Put that formula in your Detail Section. It will give you a 1 if your criteria equals true and a 0 if the criteria is false. Now right-click on the #max formula in the detail section and click Insert -> Summary. Create a sum and put it in the Group Footer. Now create a second formula "SumMax". The content of that formula is:
if {#max} > 0 then 1
else 0
Put that formula also in your Group Footer. Now right-click on "#SumMax" and do Insert -> Summary and choose Sum. Put that in the Report Footer. Suppress #max and/or #SumMax as you please.
The way it works is that it counts all the true's of your criteria in a group (#max). If the result is greater than 0, #SumMax will count 1. Then you summarize the count of #SumMax, which gives you the total.
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.