Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to determine First Record of a group

Status
Not open for further replies.

muhaidib

Programmer
Sep 27, 2005
82
SA
I am using Crystal 8.5.
I have generated a report for Invoice and Payments. The report is grouped on Invoice. Thers are more than one payments (part-payments) against an invoice. My report detail columns are PayDate, PayNo, PayAmt, AmtPaidUpdate. I am calulating "Amt paid sofar" i.e. AmtPaidUpdate by formula {amtpaid} + previous({amtpaid}). For the first group the results are ok but for next group the first value (AmtPaid) is getting added with the last value (AmtPaid) of previous group.

I want the second group and onwards values should not get added to previous value by identifying first record of each group.

Need Guidance.
 
I sorted out the problem as under: (courtsey Cthang from it.toolbox)
To do this goto to your field explorer and right click and select new Running Total. Give it a name (RecNumber) and then select the field to summarize (in my case part-payments) and select Count from the type of summary. You have to Evaluate for each record and Reset based on the group (in my case Invoice).
Then I rewrote my formulae as
if RecNumber = 1 then
{amtpaid}
else
{amtpaid} + previous({amtpaid}).

Hope this will help others with similar problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top