Re: math with multiple [founditems]

This WebDNA talk-list message is from

1999


It keeps the original formatting.
numero = 23759
interpreted = N
texte = Ok I tried this solution and it didn't seem to work:[math show=f]TotalCount=0[/math] [search db=MeriselInv.txt&eqSKUdata=95654] [founditems] [math show=f]TotalCount=TotalCount+[InvOnHand][/math] [/founditems] [/search]What's happening is we have multiple warehouses where there is inventory ([InvOnHand]) for one sku. I need to add up the inventory for each of these warehouses together. There is also a field in the database called WarehouseNo. To make things even more slippery the values of the InvOnHand field looks something like this: +0000616. That's not really a problem though because I can do something like this [math](+0000511)+(+0000330)[/math] and WebCat returns 841 (taking out the + sign and the extra zeros. That's nice.So with the above code I put parenthesis around [InvOnHand] but it still didn't work. Now I've also tried doing something really complicated like:[math] [search db=MeriselInv.txt&eqSKUdatarq=95654&eqWarehouseNodatarq=11] [founditems] ([InvOnHand]) [/founditems] [/search] + [search db=MeriselInv.txt&eqSKUdatarq=95654&eqWarehouseNodatarq=13] [founditems] ([InvOnHand]) [/founditems] [/search] + [search db=MeriselInv.txt&eqSKUdatarq=95654&eqWarehouseNodatarq=14] [founditems] ([InvOnHand]) [/founditems] [/search] + [search db=MeriselInv.txt&eqSKUdatarq=95654&eqWarehouseNodatarq=15] [founditems] ([InvOnHand]) [/founditems] [/search] [/math]Which works fine as long as every wherehouse carries the particular sku but there are instances in the data base where a sku will not have a corresponding warehouse, number 15 for example. So the last part of the above code returns nothing which then messes up the math function.I like the code at the very top though and would rather use something like that. Any more ideas?Again, just to sum up (pun intended) what I'm trying to do - I have a search that returns mulitple entries from one field (all numbers) and I'd like to add all those values together. :)Thanks BrantHoward Wolosky wrote:> simple: > define [math show=f]TotalCount=0[/math] > before your search. > > In the founditems, define: > [math show=f]TotalCount=TotalCount+[fieldname][/math] > > you're done > > -howard > > On Mon, 15 Feb 1999, es-sleestak wrote: > > > I have a search that returns mulitple entries from one field (all > > numbers) and I'd like to add all those values together. I was thinking > > something like this: > > > > [founditems][math][fieldname]+[/math][/founditems] > > > > but of course this doesn't work. How could I make this work? > > > > Thanks > > Brant > > > > > > > > > > Associated Messages, from the most recent to the oldest:

    
  1. Re: math with multiple [founditems] (Kenneth Grome 1999)
  2. Re: math with multiple [founditems] (es-sleestak 1999)
  3. Re: math with multiple [founditems] (es-sleestak 1999)
  4. Re: math with multiple [founditems] (Kenneth Grome 1999)
  5. Re: math with multiple [founditems] (PCS Technical Support 1999)
  6. Re: math with multiple [founditems] (es-sleestak 1999)
  7. Re: math with multiple [founditems] (Howard Wolosky 1999)
  8. Re: math with multiple [founditems] (charles kline 1999)
  9. math with multiple [founditems] (es-sleestak 1999)
Ok I tried this solution and it didn't seem to work:[math show=f]TotalCount=0[/math] [search db=MeriselInv.txt&eqSKUdata=95654] [founditems] [math show=f]TotalCount=TotalCount+[InvOnHand][/math] [/founditems] [/search]What's happening is we have multiple warehouses where there is inventory ([InvOnHand]) for one sku. I need to add up the inventory for each of these warehouses together. There is also a field in the database called WarehouseNo. To make things even more slippery the values of the InvOnHand field looks something like this: +0000616. That's not really a problem though because I can do something like this [math](+0000511)+(+0000330)[/math] and WebCat returns 841 (taking out the + sign and the extra zeros. That's nice.So with the above code I put parenthesis around [InvOnHand] but it still didn't work. Now I've also tried doing something really complicated like:[math] [search db=MeriselInv.txt&eqSKUdatarq=95654&eqWarehouseNodatarq=11] [founditems] ([InvOnHand]) [/founditems] [/search] + [search db=MeriselInv.txt&eqSKUdatarq=95654&eqWarehouseNodatarq=13] [founditems] ([InvOnHand]) [/founditems] [/search] + [search db=MeriselInv.txt&eqSKUdatarq=95654&eqWarehouseNodatarq=14] [founditems] ([InvOnHand]) [/founditems] [/search] + [search db=MeriselInv.txt&eqSKUdatarq=95654&eqWarehouseNodatarq=15] [founditems] ([InvOnHand]) [/founditems] [/search] [/math]Which works fine as long as every wherehouse carries the particular sku but there are instances in the data base where a sku will not have a corresponding warehouse, number 15 for example. So the last part of the above code returns nothing which then messes up the math function.I like the code at the very top though and would rather use something like that. Any more ideas?Again, just to sum up (pun intended) what I'm trying to do - I have a search that returns mulitple entries from one field (all numbers) and I'd like to add all those values together. :)Thanks BrantHoward Wolosky wrote:> simple: > define [math show=f]TotalCount=0[/math] > before your search. > > In the founditems, define: > [math show=f]TotalCount=TotalCount+[fieldname][/math] > > you're done > > -howard > > On Mon, 15 Feb 1999, es-sleestak wrote: > > > I have a search that returns mulitple entries from one field (all > > numbers) and I'd like to add all those values together. I was thinking > > something like this: > > > > [founditems][math][fieldname]+[/math][/founditems] > > > > but of course this doesn't work. How could I make this work? > > > > Thanks > > Brant > > > > > > > > > > es-sleestak

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:

Lambada for Macintosh is Here! (1996) SKU (1997) WebCat2b13MacPlugIn - [include] doesn't allow creator (1997) Re(6): Small Bug: ErrorLog.txt/[FORMVARIABLES]/[ORDERFILE] (1998) Authenticate (1997) Swear words (2002) [Sum] function? (1997) Lookup question (2001) ups quickcost [repost] (1999) Bug reported on June 6, 2000 still not fixed ... (2000) Error: Permision deny. Unable to append to (2002) Calculating multiple shipping... (1997) Pre-flight public flag (1997) RE: E-mailer error codes (1997) Re:2nd WebCatalog2 Feature Request (1996) Re:2nd WebCatalog2 Feature Request (1996) Shop from PDF (2004) truncating email part II (1997) WebCat2b15MacPlugin - showing [math] (1997) Sense/Disallow HTML tags during $Append (1997)