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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Reports 8.5

Status
Not open for further replies.

kabtjb

Technical User
Dec 2, 2003
8
US
In a report I have a column that has duplicate records and I need to be able to flag the first occurance of each dupicate record. Please help.
 
The first occurence of the duplicate, or the first row of a series of duplicating rows?

Try posting technical information when requesting it, you've supplied very little information.

Crystal version
Database
Example of existing data
Expected output

No idea if you have groups, etc. so I'll just touch on this using a formula, if you need more help, try postiong more than a short sentence:

whileprintingrecords;
numbervar CntCurr;
If previous({table.field}) = {table.field} then
CntCurr := CntCurr+1
else
CntCurr :=0

Now if the value of this formula is 1 then it's the first duplicate, if it's 0, it's the first of a type, if it's > 1 then it's yet another duplicate.

-k
 
If I use the formula below then only the previous record and the active record are bing compared. I need the active record to be compared against the entire column and continue this process until the last record in the column.

numbervar CntCurr;
If previous({table.MedRec}) = {table.MedRec} then
CntCurr := CntCurr+1
else
CntCurr :=0
 
If you decide to post technical information to describe what you want someone will help you. You ignored my questions, and simply restated another vague blurb which contradicts the original posting.

If you use my formula in the details and sort by your field it would show:


field formula result
_____
12 0
12 1 (first occurance of a dupe, per your post)
12 2
13 0
13 1 (first occurance of a dupe, per your post)
13 2
13 3
etc.

So you could either place code inside the formula to do whatever it is that you need when you have a recurrence of a dupe, or create another formula that is based on this one.

This formula does compare every row, and resets when something changes.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top