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:

    
  1. RE: Nested [SEARCH] and [REPLACE] problem. (Marc Eagle 1997)
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:

Blank orders after update to 5.1 (2003) Running _every_ page through WebCat ? (1997) TemplateCacheSize preference! (1998) Protect vs Authenicate (1997) Re:Problem (1997) Wanted: More Math Functions (or, Can You Solve This?) (1997) Install WebDNA 6.0 into MAMP/Apache 2.0 on OS X ... (2005) [OT] Flash & WebDNA (2003) Cookies? (1997) Stumpted Again (1997) WebCat2 beta 11 - new prefs ... (1997) Signal Raised (1997) Is this possible, WebCat2.0 and checkboxes (1997) Secure server question (1997) woops - speed results - right subject (2002) Search for specific characters in a string (2005) web delivery (1997) Wierd thing in ViewOrder.tpl (1999) Multiple security dbs (1997) Force leading zeros (1998)