Running Total of a Running Total - crystal-reports

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.

Related

Crystal Formula that evaluates a boolean field OR field containing not null value

Is there a way to evaluate two fields to count the total number of records that meet the following criteria
Field {NoValidAddress} = False OR Field {Email} = not null
I'm very new to Crystal so I've created a formula field so I've used the following, but this returns the total number of records in the table.
{NoValidAddresses} = false OR not (IsNull({Email})
Thank you for any help that can be given
You can easily count the number of records with values in the email field by using a formula similar to the following:
if not(isnull({Email})) or ({NoValidAddresses} = False) then 1 else 0
Once the formula is created, follow these steps:
Drag the formula onto the report as a field
Right click the field --> Insert --> Summary...
Set "Calculate this summary" to "Summary"
Check the "Add to all group levels" box
Adding the total to all group levels is probably not necessary, but it will show you the total at each group level so that you can determine which one you want to use and suppress/delete the rest.

How to count number of grouped rows in the Crystal Report

I need to count and show number of rows of grouped data in the report. I already have number of rows of total data in Report Footer section (I used Count() function and that works fine), but I need to have total rows in the Group Footer section which shows number of rows of grouped data. The visible explanation of the problem is shown under.
Thanks.
----------------------------------------------------
Group 1
row 1---------------------------
row 2---------------------------
.
.
.
row N---------------------------
--- I need here number of rows!---------------------
----------------------------------------------------
Group 2
row 1---------------------------
row 2---------------------------
.
.
.
row M---------------------------
--- I need here number of rows!---------------------
----------------------------------------------------
Total Rows: M+N
Try the solution
Create a formula #reset. Place the formula in groupheader and supress
Shared Numbervar count;
count:=0
Now create one more formula # Increment and place in section where there are rows I have assumed it as detail section and supress.
Shared Numbervar count;
count:=count+1;
count;
Now create one more formula #Display. Place this formula in Group footer
Shared Numbervar count;
Shared Numbervar Count_Final;
Count_Final:=Count_Final+count;
count;
Now create one more formula #DisplayFinal and place in Report Footer
Shared Numbervar Count_Final;
Count_Final
This solution may help someone,
Create a Running Total:
Choose a field
Select distinct count as Type of summary
Choose your group name in Reset section
Now drag and drop the running total field in group footer.
Refer the image below
This solved my problem
Create new formula field
{IM_INV.QTY_ON_HND}-{IM_INV.QTY_ON_HND}+1
{Existing field} minus {exiting field} plus 1
This gave me a "1" next to each detail line in a field I called {NumberForCount}
Because it was made this way it showed up in running total field options
Then made a running total field like normal in the footer
Another way to try by using Summary
Right Click > Insert > Summary
Choose Field (I choose string
value)
Choose "Count" to Calculate This Summary Combo box
Choose Summary Location in Where would you like to show this total
Then OK

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.

Hide rows with no values in hierarchial grouping in crystal reports

I have a crystal report - showing some financial data. As normal with financial data we have several general ledger accounts - which are grouped hierarchically. We are using grouping in Crystal report with some totals on hierarchical groups.
There are some rows where the values are zero. The groups also have total of zero as a result of this. We need to hide these rows. If we try to check the sum of the field - on the group level - it hides all the parent rows (since they themselves do not have any value - only values are derived from the child rows).
Need some way to do this in crystal?
You can suppress rows base on a condition.
In the menu go to Report->Suppress Expert...
Select the details line then select the formula button next to Suppress
You only need to put the condition that will be true to suppress the line
{[Your value field]} = 0
For groups, you will need to find the sum of your total for that particular group
SUM({[Your value field]}, {[field you are using to grouped by]}) = 0

In Crystal Reports, How do I count all the rows in the Details section and place that count in the header?

I've tried adding a new formula and used this code:
whileprintingrecords;
numbervar x;
x := x + 1;
Problem is, if I place the formula that displays the count on the header section, it only shows the first value since it hasn't yet incremented.
I need a total count of the rows in every page and just show it in the header. how do I do this?
Wait I just realized it is placed in a group not in the details section. Let me revise my question. How do I get the value of the display formula in the last page of the report? Makes sense?
The simplest way to get a total count of all the rows within the report and place it in the page header is to create a new formula, with the value:
Count ({Table.Value})
and place it in your page header (where Table.Value is a field in your dataset).
EDIT: To get a total count of all the groups, change the formula to:
DistinctCount ({Table.GroupField})
Right-click on any field in Details section, Insert Summary, select Count(), drag resulting field into page (report, group) header.
I just summarized the field with Count and put it to Group Header That's It.