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

Changing duplicates

Status
Not open for further replies.

woodyinoz

IS-IT--Management
Jan 8, 2002
215
GB
Hi all,

I'm having a bit of a no brainer today so would like your help!

I run a query which gives me a list of results, some of which are duplicated (as I would want).
For example my table may contain peoples initials so I could end up with 3 records showing JH for 3 different people (Jason Hill, John Holmes and Jimmy Hatt).
What I want to do is run a tCurosor (or something) down the table, changing duplicates by adding a number onto the end. For example, the records holding the 3 people with the initials JH should read JH, JH1 and JH2.

Can anyone help? I'm sure this is fairly simply but like I said..... my brain is on leave!

Thanks,

Woody.
 
Woody,

Here is a basic approach that should work, it's not pretty but it's early on a Monday morning :)

var
tc tcursor
sInitials string
n longint
endvar

tc.open(":priv:answer")
tc.edit()
sInitials.blank()
n = 1

scan tc:
if tc.initials = sInitials then
if n = 1 then
tc.priorRecord()
tc.initials = tc.initials + n.string()
tc.nextRecord()
n = n + 1
endif
tc.initials = tc.initials + n.string()

n = n + 1
else
sInitials = tc.initials
n = 1
endif
endscan
tc.close()

Perrrin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top