KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Another technique for automatically creating unique ID numbers for existing reco
PRODUCT: 4D | VERSION: 6.5 | PLATFORM: Mac & Win
Published On: June 29, 2001

Compare the following technique with the one I gave on 6/1/01:

https://4d.com/support/tips01-597.html

C_LONGINT($i;$NumRecs)
ALL RECORDS([File1])
$NumRecs:=Records in selection([File1])
ARRAY LONGINT($UniqueNum;$NumRecs) ` Create an array w/the unique
numbers
For ($i;1;$NumRecs)
$UniqueNum{$i}:=$i
End for
ARRAY TO SELECTION($UniqueNum;[File1]RecordNo) ` spill the array into
the selection


This method will require more memory than the previous version, but will also complete faster. Instead of going through the records one at a time with SAVE RECORD, we use the command ARRAY TO SELECTION to fill the values.