RE: Nested [SEARCH] and [REPLACE] problem.

This WebDNA talk-list message is from

1997


It keeps the original formatting.
numero = 13082
interpreted = N
texte = Michael ->I'm trying to write an admin page that let's me update inventory quantities >without shutting down my web server. To do this, I >1) Flush databases >2) Replace the quantities in the OLD database with quantities from a NEW >database >and >3) Flush database so that the changes are not just in RAM in case something >crashes. >Steps 1 and 3 are easy, but step 2 doesn't seem to work so well. Here's >the code that I'm using. I can't find anything wrong with it: >[SEARCH db=DB/NEW_Inventory.db&neskudata=0] >[FOUNDITEMS] > [Replace db=DB/OLD_Inventory.db&neSKUdata=0] > QTY=[QTY]&Append=T > [/Replace] >[/FOUNDITEMS] >[/SEARCH] >What am I doing wrong? Is there a better way to do it?After playing around a bit, I think I see a couple of things wrong with this. First off, make sure your replace values come immediately after the opening [replace] context, like[Replace db=DB/OLD_Inventory.db&neSKUdata=0]QTY=[QTY]&Append=T[/Replace]so it's not looking for a field name like ' QTY' instead of 'QTY'Next, for the replace command, you'll want to match the record found in the new database, with eqSKUdata=[SKU], instead of neSKUdata=0, otherwise all records with a SKU not equal to zero will be replaced with the same quantity for as many found items as you have, and eventually all of them will have the same quantity as the last item found in the new database. I'm not totally sure if that last part makes any sense or not, but try using something like this:[SEARCH db=DB/NEW_Inventory.db&neskudata=0] [FOUNDITEMS] [Replace db=DB/OLD_Inventory.db&eqSKUdata=[SKU]]QTY=[QTY]&Append=T[/Replace] [/FOUNDITEMS] [/SEARCH]and you should be okay.I hope this helps,Marc Eagle StarNine Technologies http://www.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
Michael ->I'm trying to write an admin page that let's me update inventory quantities >without shutting down my web server. To do this, I >1) Flush databases >2) Replace the quantities in the OLD database with quantities from a NEW >database >and >3) Flush database so that the changes are not just in RAM in case something >crashes. >Steps 1 and 3 are easy, but step 2 doesn't seem to work so well. Here's >the code that I'm using. I can't find anything wrong with it: >[SEARCH db=DB/NEW_Inventory.db&neskudata=0] >[founditems] > [Replace db=DB/OLD_Inventory.db&neSKUdata=0] > QTY=[QTY]&Append=T > [/Replace] >[/FOUNDITEMS] >[/SEARCH] >What am I doing wrong? Is there a better way to do it?After playing around a bit, I think I see a couple of things wrong with this. First off, make sure your replace values come immediately after the opening [replace] context, like[Replace db=DB/OLD_Inventory.db&neSKUdata=0]QTY=[QTY]&Append=T[/Replace]so it's not looking for a field name like ' QTY' instead of 'QTY'Next, for the replace command, you'll want to match the record found in the new database, with eqSKUdata=[SKU], instead of neSKUdata=0, otherwise all records with a SKU not equal to zero will be replaced with the same quantity for as many found items as you have, and eventually all of them will have the same quantity as the last item found in the new database. I'm not totally sure if that last part makes any sense or not, but try using something like this:[SEARCH db=DB/NEW_Inventory.db&neskudata=0] [founditems] [Replace db=DB/OLD_Inventory.db&eqSKUdata=[SKU]]QTY=[QTY]&Append=T[/Replace] [/FOUNDITEMS] [/SEARCH]and you should be okay.I hope this helps,Marc Eagle StarNine Technologies http://www.smithmicro.com/ Marc Eagle

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:

Databases inside [SHOWIF] (1998) WebCatalog for Postcards ? (1997) Serving images from databases (1998) Paradata/Moneris Gateway (2005) Word wrapping (1997) [append] vs. [appendfile] delta + question? (1997) WebDNA on Intel Mac? (2006) Testing the WebCat Email List Members (2000) Can I invoke an ssi plugin from within a webcat page (1997) [numfound] in nested [search] (2000) Posting form data to a popup (2004) Search/sort in URL Was: GuestBook example (1997) [WebDNA] Emailer Issue (2009) SiteGuard Admin Feature ? (1997) Does summarizing found records require sorting on that same field? (1999) SiteEdit NewFile.html ? (1997) Version f1 status (1997) Checking Credit Card No (2007) Upgrading old WebCat Database Files (1997) 2.0Beta Command Ref (can't find this instruction) (1997)