Solved

add a summarized field without totaling by group...

Posted on 2003-12-09
7
285 Views
Last Modified: 2012-05-04
This is probably a simple one...or not.

Using Crystal Reports 8.5, I'm running a query from an Informix database.  The query consists of
period
billing attorney
timekeeper
client number
invoice number
worked hours

and some others.  The result should be for each period there will be an invoice.  That invoice will have a dollar amount with multiple worked hour entries for each timekeeper.  I want the report to sum the worked hours by timekeeper-clientnumber-invoice-period.

If I run this query right out of Informix (dbaccess)  I can select distinct records and sum the worked hours in that fashion.  If I try this in Crystal, (summing worked hours), it will sum all worked hours for all timekeepers.

Basically if Joe had two time entries in January (5 hours and 2 hours) for client XYZ, I want the query to sum his hours (7 hours) and not include Nancy who had one time entrie of 2 hours for the same month and client.

Here is a copy of the query (not from Crystal)

SELECT DISTINCT
      period_yymm.p_yymm,
      matter.mbillaty,
      timecard.ttk,
      ledgfee.lfcode,
      timecard.tinvoice,
      ledgfee.lfamnt,
      timecard.tmatter,
      matter.mprac,
      matter.mdept,
      Sum(timecard.tworkhrs),
      timekeep.tkstdcst
FROM
      elite.ledger ledger,
      elite.ledgfee ledgfee,
      elite.matter matter,
      elite1.period_yymm period_yymm,
      elite.timecard timecard,
      elite.timekeep timekeep
WHERE
      timecard.tinvoice = ledger.linvoice AND
      timecard.tmatter = matter.mmatter AND
      timecard.ttk = timekeep.tkinit AND
      ledger.lindex = ledgfee.lindex AND
      period_yymm.pe = ledger.lperiod AND
      ((period_yymm.p_yymm>= pd_start And
      period_yymm.p_yymm <= pd_end) AND
      (ledger.llcode In ('PAY','PAY-LEG','WOFF')) AND
      (ledgfee.lfindex Not In (1776,1777,1778,1779,1780,1781)))
GROUP BY
      period_yymm.p_yymm,
      matter.mbillaty,
      timecard.ttk,
      ledgfee.lfcode,
      timecard.tinvoice,
      ledgfee.lfamnt,
      timecard.tmatter,
      matter.mprac,
      matter.mdept,
      timekeep.tkstdcst


Hopefully this makes sense to you.  Thank you.
0
Comment
Question by:AConover
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
7 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 9906366
In Crystal you can use RUNNING TOTALS to do what you want.

In the report group the data as you want it, then create the running totals

Open the FIELD SELECTOR
Select RUNNING TOTAL
Right click --> Select NEW
Give it a name
Select the field - timecard.tworkhrs
Type  - SUM
Reset - On Group Change
Evaluate - For each record

Put the running total in the group footer

You can eliminate the groups and the sum field in the query, the raw data is passed in.
Add groups in Crystal

mlmcc
0
 
LVL 1

Author Comment

by:AConover
ID: 9906441
Wow, wasn't aware of that feature.  
Ok, I don't have any groups set up, just raw detail.
0
 
LVL 1

Author Comment

by:AConover
ID: 9906626
Here's an example of the returned data.  These are all raw time entries.  TWorkhrs is summarized by timekeeper.  The 2.6 hours for FLB (ttk) is actually 3 separate entries totaling 2.6.  

p_yymm      mbillaty      ttk      lfcode      tinvoice      lfamnt      tmatter                   mprac       mdept  sum of tworkhrs
0301      FLB      FLB      PAY      23482      867.5      AE100-00122      550      20      2.6
0301      FLB      JWS      PAY      23482      867.5      AE100-00122      550      20      0.5
0301      FLB      LRM      PAY      23482      867.5      AE100-00122      550      20      0.2
0301      FLB      FLB      PAY      23483      825      AE100-02385      540      20      3
0
 
LVL 1

Author Comment

by:AConover
ID: 9907077
I'm not sure how to group the data, since I need all the raw data returned.  Any ideas?
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 100 total points
ID: 9917479
Open the report
Click INSERT --> INSERT GROUP
Select the field you want as the master group
   I think you want  -  timekeeper
Repeat for the other groups
       clientnumber
       invoice-period

mlmcc
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question