How to display count in group header in crystal report - crystal-reports

I have a crystal report in C# windows application.
Three groups are there in the report.
I need to display count for each group.
For Eg:
1. Group1.1
1. Group2.1
1. Group3.1
1.ItemDetails1
2.ItemDetails2
2. Group3.2
1.ItemDetails3
2.ItemDetails4
2. Group 2.2
1. Group3.3
1.ItemDetails5
2.ItemDetails6
2. Group3.4
1.ItemDetails7
2.ItemDetails8
2.Group1.2
like this?
I tried running total,
Field To Summarize as Group1 field,
Type as distinct count
Evaluate- for each record
Reset- On change of group
but its showing 1 everywhere.
Can anyone help?

Try Never Reset. When you reset using the field that you count, you will always get an answer of one.

Related

Crystal Report: Get Minimum Date

I have this concern using Crystal Report which I am not really familiar with. Here's my scenario:
I have an existing report to update, I need to add a column (ETA) which has a datetime value. It may return more than one rows per Item No, I need to get the minimum date only per Item No from the result rows.
I already tried some solution mentioned here http://scn.sap.com/thread/1952829 but found no luck.
I used a suppression formula for the Details section of the report, but haven't succeeded yet.
IF {TableName.DateField} = Minimum({TableName.DateField}) THEN FALSE ELSE TRUE
Any possible things you can suggest me to try? Thanks in advance for this :)
good to get this value from sqlserver side. you just create a function which return a single data (minimum date).
If you wish in crystal report side, it is something you make loop of hundred for a single row display. You can use running total field for this.
Select the field , select summary type and put into the detail section.
or you can create a formula with group name option like
Minimum({TableName.DateField})
http://scn.sap.com/thread/1952829
http://businessintelligence.ittoolbox.com/groups/technical-functional/businessobjects-crystal-l/unable-to-filter-based-on-the-first-date-in-list-of-dates-4912881
please check
Running total field gives options for Min, Max, etc. but not Sum
http://flylib.com/books/en/4.229.1.28/1/

reset variable for each group (crystal reports)

how to reset crystal reports variable value to 0 again for different group, or if I can make a variable that work only on one group but different value for another group? thanks
Create one shared variable for each group. At corresponding group header, reset the value of shared variable to zero. Below is what you can write in group header formula.
Shared numbervar num:=0;
I hope this helps.
http://wijayatony.wordpress.com/2012/11/26/crystal-report-add-record-number-that-resets-when-group-field-changes/
check this it will be helpful
As we know, field “record number” from “special fields” in Crystal Report starts from 1 and increase one by one for each record until last page of the report. However, when we need a record number field that resets from 1 whenever the group field changes, we need to manually create it.To create the record number field, here are the steps:
Create a new “Running Total Field”
Give a name for the field, for example : rtf_recordNumber
Choose a field to summarize.
Set the “Type of summary” to “count”
On “Evaluate”, choose “For each record”
On “Reset”, choose “On change of group”.
Choose the “key” group name field that will reset the record number.
Click OK
Add the field to the report.
this instructions are from above link
I agree with the above answer but only small correction instead of group footer place the reset formula in group header.

Crystal Reports XI - Suppress group header based on suppression status of sub-groups

I have a rather simple problem that I haven't managed to workout for myself despite many hours of searching the web.
I have a report containing timestamped data from a few thousand devices (loggers), to present the data in a sensible manner, I set up two groups in the report; Loggers and Timestamp so the data first grouped by logger id and then by timestamp which is working fine
Group 1 Logger 1
Group 2 Timestamp 01/08/2012
Data...
Data...
Data...
Group 2 Timestamp 02/08/2012
Data...
Data...
Group 1 Logger 2
Group 2 Timestamp 01/08/2012
Data...
Data...
Data...
Now the data (detail) fields are hidden from the user and I only want to display the header for group-2 if there are 4 or more records in each group-2. To achieve this I have used the following suppression formula on group-2
Count ({GMAC_spDg2Report;1.tTimeStamp}, {GMAC_spDg2Report;1.tTimeStamp}, "daily") < 4
The trick is that there are certain level 1 groups where all group-2 headers are suppressed and where this is the case, I want to hide the group-1 header as well.
Using the same suppression formula as group-2 in group 1 did not yield the desired result. I have also tried to use a running total (called {#Count Unsupressed Days}) in the group-1 footer with a distinct count and the formula below being reset on each group-1
Count ({GMAC_spDg2Report;1.strLogger}, {GMAC_spDg2Report;1.tTimeStamp}, "daily") > 4
The running total works perfectly, returning a 1 in group-1 footer if the group has sub groups that are not suppressed and 0 if all group-2 headers are suppressed.
So here is the CHALLENGE, I cannot seem to apply a suppression rule in the header of group-1 using the output from the running total.
To demonstrate the problem I created a formula field containing only the output from the running total and placed this in the group-1 header.
The results are confusing to say the least... the formula field does not show the same value as the running total and hence the suppression rule is not working.
I hope this makes some kind of sense... I feel like I have tried everything
I don't have a definite solution, but using a formula field starting with
WhilePrintingRecords;
...
the formula will be processed after all records are read, and therefore you will be able to use it in section headers with correct result.
Now there is the problem of finding a formula logic that will be of use for you, but perhaps this first step can help you in the right direction.
I had a similar problem once. As I remember, the trick was to check Suppress blank section in every detail section and checking some similar sounding option Suppress blank group (?) in group header section.
Sorry I can't give you the exact name, it's long ago and I used the German version. I know it's possible without formulas, though.
I take it you don't use sub reports. If you do, note that the trick only works if the sub report has the option Suppress empty report (?) checked along with what I wrote above.

Crystal Report-Running Total

I have a problem with running Total in Crsystal report9
if their is no values available for a Paticular field how can we return the running total as '0'
Instead of display the Running Total directly in your report create a Formula Field based on the Running Total and drag it into the report.
Your formula should look like this (Crystal Syntax)...
if ISNULL({#RunningTotalField}) then
"0.00"
else
ToText(RunningTotalField, 2)
If there is no data for that particular group, then Crystal won't show it easily. Your options are :
1) Use subreports to display the values for a particular group, and keep the main report just looking at the table(s) containing the group headers.
2) Use a stored procedure as the source so you have full control over the SQL that is run.
The problem is that as soon as you use a field to group, Crystal will only return records where that field has been used. If it was simply in the Details section you could modify the link to a LEFT JOIN and it wouldn't matter, but the group forces the INNER JOIN which means the groups without data are not returned.
Unfortunately Running Totals don't show up if there are no records that match your criteria. An alternative is to use a set of formulas calculated in various sections of the report. The technique is widely described in the Crystal literature. For example, this TekTips gives a very succinct overview of your options.
You set up an initialising formula in each header, with the evaluation time directive "WhilePrintingRecords". This approach was the only one available for doing running totals in the "good ol' days" before RunningTotal objects were available.

Conditional group SUM in Crystal Reports

I've been doing some accounting reports and have been summing up my different currencies using a formula
IE
CanadianCommissionFormula
if {myData;1.CurrencyType} = "CDN" then
{myData;1.Commission}
else
0
CanadianCommissionSum
SUM({#CanadianCommissionFormula})
Then I'd just display the CanadianCommissionSum at the bottom of the report and things were great.
I've just come across the requirement to do this, but grouped by Sales Rep. I tried using my previous formula, but this sums for the whole report. Is there an easy way to sum like this, based on which group it's in?
You probably figured this out a year ago, but just in case, try this:
Change your CanadianCommissionSum formula to
SUM({#CanadianCommissionFormula},{SalesRep})
Put this formula in your SalesRep's Group Footer section.
This should now display properly.
Create a group based on the sales rep in the Crystal Report, and place the:
SUM({#CanadianCommissionFormula})
...in the footer of the group.
I would assume that rexem's suggestion should work but since you said it gives you a total all of the sales reps you could change the sum to running total. Before doing this I'd double check that you have your field in the correct footer section though.
To do the running total, group by Sales Rep, and then set up your running total to evaluate on every record and reset on the change of the group. Then you can put this running total in the group footer and it will show subtotals.
Hope this helps.