Re: [REPLACE] inside [FOUNDITEMS]

This WebDNA talk-list message is from

1998


It keeps the original formatting.
numero = 19191
interpreted = N
texte = I've tested it, and it *DOES* change the index value -- in some situations.It all depends on the search parameters you're using and on what the replace context changes. Naturally if the only parameter you use in a search is the SKU and the replace context changes something in the recordDate field, or in any field OTHER THAN the SKU field, the replace will work properly -- because the replace is NOT changing anything in the only field used in the search.But this is a very simple situation, and it's foolish to suggest that this will work consistently every time when in another situation it will not work, such as ...When the search is being performed on an itemName field and the replace context changes the itemName value. That will *usually* cause the changed item to NOT show up in an identical search, or else the order of the resulting items will be changed. In either case, the results will not be identical in a similar search, because the index values in the first search will not match the same index values in the second search, so the replace will replace values in the wrong records.To get really technical about this, you can say In SOME cases, specifically when the replace context changes a value in a field that's named in one of the search parameters, and when that change causes a second search to no longer produces the exact same results as in the original search, then replace will fail to perform properly inside a founditems context.But as a general rule, it's far easier to remember to NOT use replace (or delete) inside a founditems loop. Maybe when 3.0 is released, the new docs will warn users about this problem, which has existed undocumented since WebCat 2.0 or earlier ... >Maybe Grant can clarify this, but I don't believe that [replace] will >change the [index] values (the positions of the rows in the db), just the >values in the database. > >At 4:10 PM 7/29/98, Kenneth Grome wrote: >>It is unfortunately still NOT documented, but it is nevertheless a very >>BAD practice to use delete or replace contexts inside founditems loops. >>The reason has to do with the way the founditems loop works. It uses the >>[index] value of the found items in a way that causes it to fail when >>*any* of the index values change during the looping process. So, since >>replace and delete are the two actions that can change the relative index >>values of the items inside the loop, you should NEVER use delete or >>replace inside a founditems context. > > > >o--------------- Dave MacLeay --+ >o----------- Digital Frontier --+ >o--- dave@digitalfrontier.com --+ Sincerely, Ken Grome 808-737-6499 WebDNA Solutions mailto:ken@webdna.net http://www.webdna.net Associated Messages, from the most recent to the oldest:

    
  1. Re: [REPLACE] inside [FOUNDITEMS] (Kenneth Grome 1998)
  2. Re: [REPLACE] inside [FOUNDITEMS] (Peter Ostry 1998)
  3. Re: [REPLACE] inside [FOUNDITEMS] (Michael Winston 1998)
  4. Re: [REPLACE] inside [FOUNDITEMS] (Kenneth Grome 1998)
  5. Re: [REPLACE] inside [FOUNDITEMS] (Bob Minor 1998)
  6. Re: [REPLACE] inside [FOUNDITEMS] (PCS Technical Support 1998)
  7. Re: [REPLACE] inside [FOUNDITEMS] (Michael Winston 1998)
  8. Re: [REPLACE] inside [FOUNDITEMS] (PCS Technical Support 1998)
  9. Re: [REPLACE] inside [FOUNDITEMS] (Dave MacLeay 1998)
  10. Re: [REPLACE] inside [FOUNDITEMS] (PCS Technical Support 1998)
  11. Re: [REPLACE] inside [FOUNDITEMS] (Kenneth Grome 1998)
  12. RE: [REPLACE] inside [FOUNDITEMS] (Olin 1998)
  13. [REPLACE] inside [FOUNDITEMS] (Michael Winston 1998)
  14. Re: [REPLACE] inside [FOUNDITEMS] (Dave MacLeay 1998)
  15. RE: [REPLACE] inside [FOUNDITEMS] (Olin 1998)
I've tested it, and it *DOES* change the index value -- in some situations.It all depends on the search parameters you're using and on what the replace context changes. Naturally if the only parameter you use in a search is the SKU and the replace context changes something in the recordDate field, or in any field OTHER THAN the SKU field, the replace will work properly -- because the replace is NOT changing anything in the only field used in the search.But this is a very simple situation, and it's foolish to suggest that this will work consistently every time when in another situation it will not work, such as ...When the search is being performed on an itemName field and the replace context changes the itemName value. That will *usually* cause the changed item to NOT show up in an identical search, or else the order of the resulting items will be changed. In either case, the results will not be identical in a similar search, because the index values in the first search will not match the same index values in the second search, so the replace will replace values in the wrong records.To get really technical about this, you can say In SOME cases, specifically when the replace context changes a value in a field that's named in one of the search parameters, and when that change causes a second search to no longer produces the exact same results as in the original search, then replace will fail to perform properly inside a founditems context.But as a general rule, it's far easier to remember to NOT use replace (or delete) inside a founditems loop. Maybe when 3.0 is released, the new docs will warn users about this problem, which has existed undocumented since WebCat 2.0 or earlier ... >Maybe Grant can clarify this, but I don't believe that [replace] will >change the [index] values (the positions of the rows in the db), just the >values in the database. > >At 4:10 PM 7/29/98, Kenneth Grome wrote: >>It is unfortunately still NOT documented, but it is nevertheless a very >>BAD practice to use delete or replace contexts inside founditems loops. >>The reason has to do with the way the founditems loop works. It uses the >>[index] value of the found items in a way that causes it to fail when >>*any* of the index values change during the looping process. So, since >>replace and delete are the two actions that can change the relative index >>values of the items inside the loop, you should NEVER use delete or >>replace inside a founditems context. > > > >o--------------- Dave MacLeay --+ >o----------- Digital Frontier --+ >o--- dave@digitalfrontier.com --+ Sincerely, Ken Grome 808-737-6499 WebDNA Solutions mailto:ken@webdna.net http://www.webdna.net 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:

Ok here is a question? (1997) Showif, Hideif reverse logic ? (1997) YA 4.5.1 problem (2004) CAll me Crazy (2000) can WC render sites out? (1997) [tcpsend] (2001) WebCat for Unix?? (1997) AuthorizeNet SSL Update (2004) Nesting format tags (1997) Database (2002) RE: format problem on NT? (1997) $Replace with [founditems] (1997) Bit off subject -- Faxing orders (1997) WebDNA Solutions ... sorry! (1997) Explorer 3.0 (1997) converting characters in form (1997) Running a store on BOTH http and https (1998) Configuring E-mail (1997) syntax question, not in online refernce (1997) Requiring that certain fields be completed (1997)