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!

Program for sequential numbering

Status
Not open for further replies.

Roper7

Technical User
Aug 23, 2001
4
0
0
US
I'm a neophyte with Fox Pro. I am working with data that has approximately 20,000 records in it, and I need to sequentially number each row from 1 to 20,090. I realize I need to do some sort of Replace command, but I want to create a program to do this. I have a little experience with Visual Basic, but don't know much about Fox Pro programming. Can someone help me with this? Thanks- Lee
 
Hi

USE MyDBF
LOCAL mySno
mySno = 1
SCAN FOR !DELETED()
REPLACE fldSno WITH mySno
mySno = mySno+1
ENDSCAN

Hope this helps
ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
LET KNOW IF THIS HELPED. ENOUGH EXPERTS ARE HERE TO HELP YOU OUT! BEST OF LUCK :)
 
&& these may be helpful in the command window
use mydbf
replace all seq_no with recno()

&& if you want some char field to use

use mydbf
replace all seq_no with alltrim(str(recno()))

&& if you want to pad with zero's with char

use mydbf
replace all seq_no with padl(alltrim(str(recno())),7,"0")

&& the 7 is how many to pad the 0 is the pad char
 
Tennessee,
use recno() for numbering is simplyest, but dangerous,
as e.g. delete+pack may cause duplicate number
by numbering afterwards added records.
(I suppose permanent saving number as key.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top