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!

loop to suppress duplicate records

Status
Not open for further replies.

szaunbr

Technical User
Jul 5, 2006
50
US
I am working with CR 9 and a postgresql db, and an odbc connection.

I have created a report to track employee absences. This is a simple report consisting of the following fields:

employee ssn,employee name, absent date, days absent, substitute

the report is grouped by employee ssn with a sum of days absent in the group footer.

I was originally getting duplicate records for every employee, so I selected distinct records only and that eliminated the problem 99% of the time.

There are still a few records that are being duplicated and I cannot determine why. The table has a recnum field which is the primary key. I pulled that into the report and that is duplicated on the problem records.

I would like to create some sort of a loop formula, but I have never written one before. I am envisioning a formula that takes the recnum field of record number 1 and subtracts it from the recnum of record number 2. If the difference is zero, suppress record number 2. If the difference is not zero, do nothing.

Then take the recnum of record number 2 and subtract it from the recnum of record number 3..... and so on and so on.

Any help will be greatly appreciated.
 
Add a second group for {table.recnum}. Display your data in this group footer. Instead of suming the Days_Absent field create a running total that will evaluate "on change of group", that group being recnum.

MrBill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top