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 thesewarehouses together. There is also a field in the database calledWarehouseNo. To make things even more slippery the values of the InvOnHandfield looks something like this: +0000616. That's not really a problemthough 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 stilldidn'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 butthere are instances in the data base where a sku will not have acorresponding warehouse, number 15 for example. So the last part of theabove code returns nothing which then messes up the math function.I like the code at the very top though and would rather use something likethat. Any more ideas?Again, just to sum up (pun intended) what I'm trying to do - I have asearch that returns mulitple entries from one field (all numbers) and I'dlike to add all those values together. :)ThanksBrantHoward 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:
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 thesewarehouses together. There is also a field in the database calledWarehouseNo. To make things even more slippery the values of the InvOnHandfield looks something like this: +0000616. That's not really a problemthough 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 stilldidn'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 butthere are instances in the data base where a sku will not have acorresponding warehouse, number 15 for example. So the last part of theabove code returns nothing which then messes up the math function.I like the code at the very top though and would rather use something likethat. Any more ideas?Again, just to sum up (pun intended) what I'm trying to do - I have asearch that returns mulitple entries from one field (all numbers) and I'dlike to add all those values together. :)ThanksBrantHoward 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:
Quit revisited (1997)
Installing WebDNA on Linux (2007)
[OT] Google Info (2004)
Slow Server (2005)
Formatted [time] inside sendmail (2002)
Moment of Thanks (1997)
Re:Off Topic: Frames Killer? (1998)
Multiple prices (1997)
Cart Database (1999)
Problems with upload / WebCat (1998)
WebCatalog f2 Installation (1997)
Setting up shop (1997)
setting taxable to true (1997)
Help! WebCat2 bug (1997)
Languages (1997)
Just Testing (1997)
calculating unique time (1998)
taxTotal confusion (1998)
Help! WebCat2 bug (1997)
Problems with ^ could be solved with [REPLACE CHARACTERS] (1997)