Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Summarizing data Post Reply Post New Topic
Author Message
whensley
Newbie
Newbie


Joined: 02 Apr 2010
Online Status: Offline
Posts: 3
Quote whensley Replybullet Topic: Summarizing data
     Posted: 02 Apr 2010 at 2:23am
I think I've run into a bit of a problem with a report I'm finishing up.  It is a rather complicated report but what it does is basically calculate the direct and indirect hours that employees log on their "timesheet" program.  I have everything exactly the way I want except I need to summarize the indirect hours in the the footer.  So basically I want to do this:

List the most common Indirect hour types and calculate the total hours spent on each type.  For instance if there are three types (maintenance, cleanup, meetings) then I would like to list them and how many hours went toward each type.  the report shows the hours logged for each employee, but I am having a heck of a time getting this little analysis section to work.  Any help would be appreciated.  I would even be willing to email the .rpt file, because you may need to look at it to see exactly what I am doing.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 02 Apr 2010 at 4:33am
You may have to use a sub-report to do this.  However, try this first:
 
1.  Create a running total for each of the Indirect Hour Types. 
- Field to Summarize: the hours field from your data. 
- Type of summary: Sum
- Evaluate: Use a formula.  The formula must evaluate to true or false and would look something like this:  {table.indirect_time_type} = 'Maintenance'
- Reset: If this is going into the report footer, then Never, otherwise reset on the change of the appropriate group.
 
2.  Put these running totals in your report footer.
 
-Dell
IP IP Logged
whensley
Newbie
Newbie


Joined: 02 Apr 2010
Online Status: Offline
Posts: 3
Quote whensley Replybullet Posted: 02 Apr 2010 at 8:37am
I think you might be onto something there.  I tried this, but the problem is the actual hours field is not a number.  It is a string.  I don't believe that I can sum that. 
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 02 Apr 2010 at 9:07am
You'll need to create a formula to convert it to a number and then sum it.  That's the only way to get the summary you're looking for.  If it's in hh:mm format, you'll convert the "hh" part to minutes (multiply by 60), add it to the "mm" part.  I would do the sums at the minutes level.  Then create a formula to convert it back to a string in hh:mm format for display.  That formula would look something like this:
 
ToText(({#MySum})\60, 0) + ':' + ToText(({#MySum} mod 60), 0)
 
Note that the first part of this uses a backslash '\' instead of the forward slash '/' that's normall used for division.  This will get you just the integer part of the calculation so you don't have to worry about any rounding issues.
 
-Dell
IP IP Logged
whensley
Newbie
Newbie


Joined: 02 Apr 2010
Online Status: Offline
Posts: 3
Quote whensley Replybullet Posted: 02 Apr 2010 at 9:20am
I see what you're saying.  I'm still struggling I'm afraid...

Would you mind if I emailed you a copy of the report.  My fear is there is something very simple that I'm missing here and not explaining properly.
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