Re: how do I delete 1 of 2 identical records?

This WebDNA talk-list message is from

2003


It keeps the original formatting.
numero = 55109
interpreted = N
texte = can you [delete db=/db/products.db&eqSKUdatarq=1234&max=1]? ----- Original Message ----- From: "Kenneth Grome" To: "WebDNA Talk" Sent: Saturday, December 27, 2003 2:33 PM Subject: Re: how do I delete 1 of 2 identical records? > >I have a database that at one point had some poor add record code. > >As a result, one record has been duplicated exactly. Any time this > >record is updated both records are updated. I need to delete 1 of > >these records, but so far my test attempts have resulted in deleting > >both (using a test database of course). > > > All you have to do is create a way to distinguish between the two > records, then delete only one of them. Here's a simple solution that > adds a new field to the db so you can use it to distinguish one > record from another uniquely. Then it deletes one of the two (or > three or four or more) previously identical records. > > This code will delete all but one record in each set of duplicate > (triplicate, quadruplicate, etc.) records in the db, not just the > first one it finds. It is a one-step solution. The only two things > it requires is that you use a field named "sku" that is supposed to > have a unique value in it for each record, and that you also use a > .hdr file for the db you're trying to fix: > > > [text]deleteList=[/text] > [text]mostOfTheDbHeaderFile=[getchars start=2&from=end][include > xxx.hdr][/getchars][/text] > > [closedatabase xxx.db] > > [writefile xxx.hdr][mostOfTheDbHeaderFile] newField > [/writefile] > > [search db=xxx.db&neskudatarq=[blank]&asskusort=1] > > [replacefounditems][newField]=[index][/replacefounditems] > > [founditems] > > [showif [lastSKU]=[sku]] > [text]deleteList=[deleteList],[newField][/text] > [/showif] > > [text]lastSKU=[sku][/text] > > [/founditems] > > [/search] > > [delete db=xxx/db&wonewFielddatarq=[deleteList]&newFieldword=ww] > > -- > > Kenneth Grome > > ------------------------------------------------------------- > 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://webdna.smithmicro.com/ > ------------------------------------------------------------- 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://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: how do I delete 1 of 2 identical records? ( Kenneth Grome 2003)
  2. Re: how do I delete 1 of 2 identical records? ( Brian Fries 2003)
  3. Re: how do I delete 1 of 2 identical records? ( Grant Hulbert 2003)
  4. Re: how do I delete 1 of 2 identical records? ( "Andrew Simpson" 2003)
  5. Re: how do I delete 1 of 2 identical records? ( Kenneth Grome 2003)
  6. Re: how do I delete 1 of 2 identical records? ( Brian Fries 2003)
  7. Re: how do I delete 1 of 2 identical records? ( "Matthew Bohne" 2003)
  8. Re: how do I delete 1 of 2 identical records? ( Kenneth Grome 2003)
  9. Re: how do I delete 1 of 2 identical records? ( "Andrew Simpson" 2003)
  10. Re: how do I delete 1 of 2 identical records? ( Kenneth Grome 2003)
  11. Re: how do I delete 1 of 2 identical records? ( Gary Krockover 2003)
  12. how do I delete 1 of 2 identical records? ( CN Stuff 2003)
can you [delete db=/db/products.db&eqSKUdatarq=1234&max=1]? ----- Original Message ----- From: "Kenneth Grome" To: "WebDNA Talk" Sent: Saturday, December 27, 2003 2:33 PM Subject: Re: how do I delete 1 of 2 identical records? > >I have a database that at one point had some poor add record code. > >As a result, one record has been duplicated exactly. Any time this > >record is updated both records are updated. I need to delete 1 of > >these records, but so far my test attempts have resulted in deleting > >both (using a test database of course). > > > All you have to do is create a way to distinguish between the two > records, then delete only one of them. Here's a simple solution that > adds a new field to the db so you can use it to distinguish one > record from another uniquely. Then it deletes one of the two (or > three or four or more) previously identical records. > > This code will delete all but one record in each set of duplicate > (triplicate, quadruplicate, etc.) records in the db, not just the > first one it finds. It is a one-step solution. The only two things > it requires is that you use a field named "sku" that is supposed to > have a unique value in it for each record, and that you also use a > .hdr file for the db you're trying to fix: > > > [text]deleteList=[/text] > [text]mostOfTheDbHeaderFile=[getchars start=2&from=end][include > xxx.hdr][/getchars][/text] > > [closedatabase xxx.db] > > [writefile xxx.hdr][mostOfTheDbHeaderFile] newField > [/writefile] > > [search db=xxx.db&neskudatarq=[blank]&asskusort=1] > > [replacefounditems][newField]=[index][/replacefounditems] > > [founditems] > > [showif [lastSKU]=[sku]] > [text]deleteList=[deleteList],[newField][/text] > [/showif] > > [text]lastSKU=[sku][/text] > > [/founditems] > > [/search] > > [delete db=xxx/db&wonewFielddatarq=[deleteList]&newFieldword=ww] > > -- > > Kenneth Grome > > ------------------------------------------------------------- > 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://webdna.smithmicro.com/ > ------------------------------------------------------------- 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://webdna.smithmicro.com/ "Andrew Simpson"

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 w/F2 (1997) [OT] Puget Sound Meteorites? (2004) More Shopping Cart Problems (2000) Reversed words (1997) [WebDNA] WebDNA databases not showing? (2013) HELP - NONE STOP DIGESTS. Digest for 4/24/97) (1997) [BULK] [WebDNA] Candidate versions release (2010) Error after loading WebDNA (2004) Fwd: Problems with Webcatalog Plug-in (1997) TCP Connect (2003) Building Calendars (1997) Bug in 4.5 - Needs to be fixed ASAP. (2002) OT Weird Messenger Service message (2002) Bug Report in the docs or? Listfields WebDNA 4.5 (2002) Price Hacking (1998) [WebDNA] Processor Maxing out (2010) All choices on IE different than Netscape (1997) WebCatalog Programmer looking for a new job (2001) WebCatalog NT beta 18 now available (1997) [Webcat 2]Next (1997)