Re: OK to delete records while finding them?
This WebDNA talk-list message is from 2000
It keeps the original formatting.
numero = 32477
interpreted = N
texte = >Is there some inherent danger in deleting a record from a db within >a [founditems] loop which is finding>records in that same db?Yes, the founditems loop relies on the [index] position of the found items to be there every time it loops thru them, and deleting records ends up changing the index values of specific records, thus making the delete act on the wrong records, or failing to act on all the records you want it to act on.It's best to use founditems to create a SKU list of records to be deleted, then use that list in a single delete tag appearing AFTER the search context.>(I am setting up to do that now and thought maybe I remember some >discussion on this topic way back...?)>>ie- (carriage returns added for clarity only)>>[Search db=some.db>&eqMasterIDdatarq=[id]>&eqDestSectNumdatarq=[DestSectNum]>&PiSiNumsort=1>&PiSiNumsdir=as>&PiSiNumtype=num]>>[FoundItems]>>[showif [someCriteria]=isMet]>[DELETE db=some.db>&eqMasterIDdatarq=[id]>&eqDestSectNumdatarq=[DestSectNum]>&eqPiSiNumdatarq=[PiSiNum]]>[/showif]>>[/FoundItems][/Search]>>??>>Is this kosher? if not, then why not? And what is the workaround?>>-John>>>------------------------------------------------------------->This message is sent to you because you are subscribed to> the mailing list
.>To unsubscribe, E-mail to: >To switch to the DIGEST mode, E-mail to >>Web Archive of this list is at: http://search.smithmicro.com/================================Kenneth Grome, WebDNA Consultant808-737-6499 http://webdna.net================================-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/
Associated Messages, from the most recent to the oldest:
>Is there some inherent danger in deleting a record from a db within >a [founditems] loop which is finding>records in that same db?Yes, the founditems loop relies on the [index] position of the found items to be there every time it loops thru them, and deleting records ends up changing the index values of specific records, thus making the delete act on the wrong records, or failing to act on all the records you want it to act on.It's best to use founditems to create a SKU list of records to be deleted, then use that list in a single delete tag appearing AFTER the search context.>(I am setting up to do that now and thought maybe I remember some >discussion on this topic way back...?)>>ie- (carriage returns added for clarity only)>>[Search db=some.db>&eqMasterIDdatarq=[id]>&eqDestSectNumdatarq=[DestSectNum]>&PiSiNumsort=1>&PiSiNumsdir=as>&PiSiNumtype=num]>>[founditems]>>[showif [someCriteria]=isMet]>[DELETE db=some.db>&eqMasterIDdatarq=[id]>&eqDestSectNumdatarq=[DestSectNum]>&eqPiSiNumdatarq=[PiSiNum]]>[/showif]>>[/FoundItems][/Search]>>??>>Is this kosher? if not, then why not? And what is the workaround?>>-John>>>------------------------------------------------------------->This message is sent to you because you are subscribed to> the mailing list .>To unsubscribe, E-mail to: >To switch to the DIGEST mode, E-mail to >>Web Archive of this list is at: http://search.smithmicro.com/================================Kenneth Grome, WebDNA Consultant808-737-6499 http://webdna.net================================-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/
Kenneth Grome
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:
emailer setup (1997)
Shopping Cart Deletion (2000)
[Announce] Newest Commerce Site based on WebCatalog (1997)
Encrypt question. (2000)
Which GUI HTML editors work with WC ? (1997)
Frames and WebCat (1997)
users.db (1999)
page redirect in webDNA (1997)
WebCat2 - Getting to the browser's username/password data (1997)
Banners (1997)
Can't Update records (1997)
More on the email templates (1997)
Calendar (1997)
ShowIf variables (1997)
ooops...WebCatalog [FoundItems] Problem - LONG - (1997)
{Grouping} Docs (1999)
Price override (2004)
Obtaining a dice result (2007)
[WriteFile] problems (1997)
carriage returns in data (1997)