Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to resequence records in a table with an index order
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00175236
Message ID:
00175352
Views:
33
Brenda,

Two suggestions:

1. If the file is small enough, copy it to a second table with the original index set on. The resulting file will be in index order. Then make your replaces on this table with no index set.

2. If the table is too large to make a temp. copy: Write a loop into your code which stores the ID and SEQ codes BEFORE you replace and the SEQ AFTER you replace it. Then do a SEEK on the stored ID and SEQ to check for duplicates. If none are found, skip and continue. If a second (third, fourth) are found, increment the "AFTER SEQ" value you stored and replace the found record and so forth.

HTH
Barbara

>Want to resequence my customer records, within customerid. Had a program bug that resulted in some sequence number gaps and duplicates. I first open cust.dbf and then order by custidseq. As I replace the sequence number, some records are bypassed.
>
>CustID Seq
>123 1
>123 1
>123 1
>123 2
>333 1
>333 2
>444 1
>
>When record #2 is resequenced to 2, then because of the custidseq order, record #3 is bypassed.
>
>What is a good way to requence?
>
>Brenda
Barbara Paltiel, Paltiel Inc.
Previous
Reply
Map
View

Click here to load this message in the networking platform