Re: Renumbering Database Records
This WebDNA talk-list message is from 1999
It keeps the original formatting.
numero = 23722
interpreted = N
texte = > How can I renumber the records in a database? I have a database with a>field ID. I want to go throught the database, possibly sorting on some>other field, and number the records 1,2,3,4,... etc so I can have a>unique ID for each record. After that, for example, I can use this ID to>delete a record.It almost sounds like your field ID is *already* the unique ID you'relooking for. Is it not?You're adding numbers to something that doesn't already have uniqueidentifiers in it? The tough part there is going to be figuring out how touniquely determine which record you want to modify. For instance, the[Replace] context which you'll be using for your renumbering task needs tobe given a set of search criteria that uniquely identify the record. Ifyou give it something non-unique to search for, then it will end uprenumbering all found records with the *same* number.So your task is to come up with a search that will always find just onerecord. Once you can do that, you can use a little [math] to increment anumber once for each found record, then [replace] the sku with that number.Technical Support | ==== eCommerce and Beyond ====Pacific Coast Software | WebCatalog, WebMerchant,11770 Bernardo Plaza Court | SiteEdit Pro, PhotoMaster,San Diego, CA 92128 | Typhoon619/675-1106 Fax: 619/675-0372 | http://www.smithmicro.com/
Associated Messages, from the most recent to the oldest:
> How can I renumber the records in a database? I have a database with a>field ID. I want to go throught the database, possibly sorting on some>other field, and number the records 1,2,3,4,... etc so I can have a>unique ID for each record. After that, for example, I can use this ID to>delete a record.It almost sounds like your field ID is *already* the unique ID you'relooking for. Is it not?You're adding numbers to something that doesn't already have uniqueidentifiers in it? The tough part there is going to be figuring out how touniquely determine which record you want to modify. For instance, the
[replace] context which you'll be using for your renumbering task needs tobe given a set of search criteria that uniquely identify the record. Ifyou give it something non-unique to search for, then it will end uprenumbering all found records with the *same* number.So your task is to come up with a search that will always find just onerecord. Once you can do that, you can use a little
[math] to increment anumber once for each found record, then
[replace] the sku with that number.Technical Support | ==== eCommerce and Beyond ====Pacific Coast Software | WebCatalog, WebMerchant,11770 Bernardo Plaza Court | SiteEdit Pro, PhotoMaster,San Diego, CA 92128 | Typhoon619/675-1106 Fax: 619/675-0372 | http://www.smithmicro.com/
PCS Technical Support
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
[WebDNA] Convert Carriage Return From DB to Plain Text File (2019)
RE: Automatic Forwarding using WebCat (1997)
[WriteFile] problems (1997)
Newbie problem blah blah blah (1997)
Country & Ship-to address & other fields ? (1997)
Mac: LModelDirector bug fix (1997)
webstar (ot) (2001)
New Command prefs ... (1997)
Newbie problem blah blah blah (1997)
Car Database (2002)
WebCatalog2 Feature Feedback (1996)
Feature req. (2002)
[ShowIf] and empty fields (1997)
Email (1998)
Thanks for tips, more quest (1997)
email database file (2005)
[Announce]: Web server security and password protection (1997)
Locking up with WebCatalog... (1997)
Re:quit command on NT (1997)
Add to cart issue (2007)