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:

off topic, converting mail (1998) Emailer help....! (1997) sorting and summarizing (1998) Email within tmpl ? (1997) email program problem (1998) Fun with dates (1997) Re:HTTP header line is too long? (1997) Banners and sort of random display (1997) [WebDNA] Downloadable file protection (2011) [WebDNA] Calculate Cube root (2012) WebDNA error. (2006) Form Submition (2003) upgrade? (1997) Re:Searching for ALL / empty form field (1997) Webcat 3 Bug?!?! Netscape + Protect + Posted Form (1998) Running _every_ page through WebCat ? (1997) Can't load tmpl files (1997) Latin Characters (1998) WebCat2b13 Mac plugin - [sendmail] and checkboxes (1997) creator code (1997)