Re: Updating Integer value in DB

This WebDNA talk-list message is from

2007


It keeps the original formatting.
numero = 68679
interpreted = N
texte = Ki Song, I would strongly suggest you use on_hand rather than on hand. I would never include a space in a database field name or a variable name. Also, you want eqSKU..., not wqSKU... in your replace context. The following should work. You could probably also do it in one single step, but I usually do the text context first, in a separate step. [text show=t]newonhand=[math show=t][lookup db=^inventory.db&lookinfield=sku&value=[sku]&returnfield=on_hand] + [updatevalue][/math][/text] [replace db=^inventory.db&eqSKUdatarq=[sku]]on_hand=[newonhand][/ replace] I hope this helps. -- James P. Ziegler Director of Web Services Plank Road Publishing www.MusicK8.com (Web Site for Music Teachers) www.MusicK8Kids.com (Web Site for Students) www.ResourcefulClassroom.com (Web Site for Classroom Teachers) www.SchoolMusicMatters.com (Music Advocacy Web Site) On Mar 14, 2007, at 11:24 AM, Ki Song wrote: > Really quick question. I am trying to create a call to a > products.db to > update a quantity on an inventory item so that, for example, if the > value > that is in the db currently is 2, and I wanted to add 1 to the > quantity, how > would I accomplish this? > > I wrote the following replace command, but it doesn't seem to work: > > [replace db=^inventory.db&wqSKUdatarq=[SKU]]ON HAND=[MATH]ON > HAND+[updatevalue][/MATH][/replace] > > updatevalue = an integer, positive or negative, that is used to > change the > ON HAND. > > For example: > SKU= test > ON HAND= 3 > updatevalue= 45 > > After this replace is done, ON HAND should = 48. ------------------------------------------------------------- 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: Updating Integer value in DB ( Stuart Tremain 2007)
  2. Re: Updating Integer value in DB ( Matthew A Perosi 2007)
  3. Re: Updating Integer value in DB ( Donovan Brooke 2007)
  4. Re: Updating Integer value in DB ( "Dan Strong" 2007)
  5. Re: Updating Integer value in DB ( Matthew A Perosi 2007)
  6. Re: Updating Integer value in DB ( Ki Song 2007)
  7. Re: Updating Integer value in DB ( Jim Ziegler 2007)
  8. Re: Updating Integer value in DB ( Matthew A Perosi 2007)
  9. Updating Integer value in DB ( Ki Song 2007)
Ki Song, I would strongly suggest you use on_hand rather than on hand. I would never include a space in a database field name or a variable name. Also, you want eqSKU..., not wqSKU... in your replace context. The following should work. You could probably also do it in one single step, but I usually do the text context first, in a separate step. [text show=t]newonhand=[math show=t][lookup db=^inventory.db&lookinfield=sku&value=[sku]&returnfield=on_hand] + [updatevalue][/math][/text] [replace db=^inventory.db&eqSKUdatarq=[sku]]on_hand=[newonhand][/ replace] I hope this helps. -- James P. Ziegler Director of Web Services Plank Road Publishing www.MusicK8.com (Web Site for Music Teachers) www.MusicK8Kids.com (Web Site for Students) www.ResourcefulClassroom.com (Web Site for Classroom Teachers) www.SchoolMusicMatters.com (Music Advocacy Web Site) On Mar 14, 2007, at 11:24 AM, Ki Song wrote: > Really quick question. I am trying to create a call to a > products.db to > update a quantity on an inventory item so that, for example, if the > value > that is in the db currently is 2, and I wanted to add 1 to the > quantity, how > would I accomplish this? > > I wrote the following replace command, but it doesn't seem to work: > > [replace db=^inventory.db&wqSKUdatarq=[SKU]]ON HAND=[math]ON > HAND+[updatevalue][/MATH][/replace] > > updatevalue = an integer, positive or negative, that is used to > change the > ON HAND. > > For example: > SKU= test > ON HAND= 3 > updatevalue= 45 > > After this replace is done, ON HAND should = 48. ------------------------------------------------------------- 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/ Jim Ziegler

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:

Special delete ... (1997) WebMerchant problems (2000) Protect vs Authenicate (1997) Wierd problem with 3.08 WIN Version (2000) I'm Sorry - OFF TOPIC (2000) Simple Store (2000) 4.5 -> 6.0 Upgrade (2005) Running _every_ page through WebCat-error.html (1997) how to know the [LineIndex] number webcat generated during a (2000) Bug Report, maybe (1997) HELP WITH DATES (1997) Help!!!! (1997) Re:2nd WebCatalog2 Feature Request (1996) [SearchString] problem with [search] context (1997) Pulldown Menu Problem (2000) Number of Feilds Passed to [append] (2000) RE: Webcatalog and CyberSTUD (1998) Pithy questions on webcommerce & siteedit (1997) Re:trouble (1997) PCS Frames (1997)