Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: How to count the details section in crystal report Post Reply Post New Topic
Author Message
ksgkrissh
Newbie
Newbie
Avatar

Joined: 19 Aug 2012
Location: India
Online Status: Offline
Posts: 5
Quote ksgkrissh Replybullet Topic: How to count the details section in crystal report
     Posted: 20 Aug 2012 at 6:12am
I've a condition in which i'll get daily work report of an employee along with his status,whether he is in leave or standby or leave etc.I am displaying this in crystal report and its working fine..

My report format is like this
EmpName
Date        SiteName Designation Status
01/08/2012   blahblah blahblah     Working    
02/08/2012                             Leave

I want to get the total days an employee worked and the total leave he has taken using this report...
How can i do this ????


Edited by ksgkrissh - 20 Aug 2012 at 6:20am
GopiKrishnan
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 20 Aug 2012 at 6:21am
Try this:
 
1.  Group by employee.
2.  Create a running total:
Field to Summarize: Date
Summary:  Distinct Count
Evaluate on: Formula - {MyTable.Status} = "Working"
Reset on: Change of group - Group from step 1.
 
You'll create another one for status = "Leave".
 
When using running totals, the numbers have to be displayed in the group footer - they're not available for the group header.  If you MUST have the numbers in the header, there's another way this can be done.  Let me know and I'll post it.
 
-Dell
IP IP Logged
ksgkrissh
Newbie
Newbie
Avatar

Joined: 19 Aug 2012
Location: India
Online Status: Offline
Posts: 5
Quote ksgkrissh Replybullet Posted: 20 Aug 2012 at 7:05am
hi,
Thankyou very much for ur wonderful answer.I would like to ask u some doubts regarding this...

1.Why we've taken date as summarize field?
2.Why we're using distinct count instead of normal count?
GopiKrishnan
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 20 Aug 2012 at 7:12am
Not knowing for sure how your data is set up, I made some assumptions.
1.  You said you wanted to count the number of days.  I assumed you have one record for each day.
 
2.  Distinct count takes care of issues if there are multiple records on the same date.
 
-Dell
IP IP Logged
ksgkrissh
Newbie
Newbie
Avatar

Joined: 19 Aug 2012
Location: India
Online Status: Offline
Posts: 5
Quote ksgkrissh Replybullet Posted: 20 Aug 2012 at 7:18am
I also has a period in the report header,which show the first date-last date(Eg: Period:01/08/2012-31/08/2012).

How can i get the first and last date only and show it in header section ...
GopiKrishnan
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 20 Aug 2012 at 11:37am

Look at the Minimum() and Maximum() functions - they work on any type of field, not just numbers.

 
-Dell
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum