Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Make field entry unique
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Make field entry unique
Miscellaneous
Thread ID:
01681459
Message ID:
01681459
Views:
83
Hi,

Here is another "dumb" question.

I have a table (.DBF) a segment of which looks like this:
ID_FIELD
'ABC'
'CBS'
'NBC'
'NBC'
'NBC'
'XYZ'
'MMY1'
'MMY1'
So some records have an ID that already exists. Other records have unique ID.
I want to run this table through a PRG and add a suffix '1', or '2', or '3' (depending on each duplicate record). So that the above table would look like this:
ID_FIELD
'ABC'
'CBS'
'NBC1'
'NBC2'
'NBC3'
'XYZ'
'MMY11'
'MMY12'
What I tried:
I set index on the field ID_FIELD. Then DO WHILE and DO WHILE. But as soon as I replace the ID_FIELD with a new ID (with a suffix '1', or '2') it goes out of scope.

What do you suggest?

TIA

UPDATE. I can solve the above by having a dummy field (suffix c(10)) and scan the records updating only field suffix and not ID_FIELD. Then adding suffix to the ID_FIELD.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Next
Reply
Map
View

Click here to load this message in the networking platform