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:
[WebDNA] Script choking on POP download (2010)
Looking up two prices in database? (1997)
Setting up shop (1997)
Uploading out of FMP (2001)
Questions To Answer (1997)
Summing fields (1997)
WebCatalog f2 Installation (1997)
[WebDNA] macOS 10.13.3 and WebDNA Mac Server 8.5.1 - hick-up (2019)
WCS Newbie question (1997)
How to include weather (2000)
[searchString] (1997)
Loss in Form (1998)
send mail problem? (1997)
WebTrends (2002)
Displaying raw values (1998)
problems with 2 tags (1997)
Payment Processors (2005)
Fault tolerance (2000)
auto adding SKUs w/DB helper (1998)
Dummy Credit Card Number for debug? (1997)