Re: Calculating a total
This WebDNA talk-list message is from 2000
It keeps the original formatting.
numero = 36197
interpreted = N
texte = On 8/15/00 6:19 pm, Stuart Tremain so noted...>I've rethought this:>>and come up with a workable solution:>>[Text]NewSubTotal=[math]total=[lineitems]>[math]([quantity]*[price])*>[ShowIf [Math]([weeks]/4)*[quantity][/math]<3]0.95[/ShowIf]>[ShowIf [Math]([weeks]/4)*[quantity][/math]=3]0.9[/Showif]>[ShowIf [Math]([weeks]/4)*[quantity][/math]=4]0.9[/Showif]>[ShowIf [Math]([weeks]/4)*[quantity][/math]=5]0.9[/Showif]>[ShowIf [Math]([weeks]/4)*[quantity][/math]=6]0.85[/Showif]>[ShowIf [Math]([weeks]/4)*[quantity][/math]=7]0.85[/Showif]>[ShowIf [Math]([weeks]/4)*[quantity][/math]=8]0.85[/Showif]>[ShowIf [Math]([weeks]/4)*[quantity][/math]=9]0.8[/Showif]>[ShowIf [Math]([weeks]/4)*[quantity][/math]=10]0.8[/Showif]>[ShowIf [Math]([weeks]/4)*[quantity][/math]=11]0.8[/Showif]>[SHOWIF [Math]([weeks]/4)*[quantity][/math]>11]0.75[/Showif]>[/math]>+[/lineitems]0[/math][/Text]Any time I do the same calculation more than once, I tend to give it its own variable.[Text]NewSubTotal=[math]total=[lineitems][math show=f]w=([weeks]/4)*[quantity][/math][math]([quantity]*[price])*[ShowIf [w]<3]0.95[/ShowIf][ShowIf [w]=3]0.9[/Showif][ShowIf [w]=4]0.9[/Showif][ShowIf [w]=5]0.9[/Showif][ShowIf [w]=6]0.85[/Showif][ShowIf [w]=7]0.85[/Showif][ShowIf [w]=8]0.85[/Showif][ShowIf [w]=9]0.8[/Showif][ShowIf [w]=10]0.8[/Showif][ShowIf [w]=11]0.8[/Showif][ShowIf [w]>11]0.75[/Showif][/math]+[/lineitems]0[/math][/Text]... I wonder which has less overhead in the long run -- repeated [math] expressions, or the setting and recalling of the variables? Does WebCat recognize when it's performing a repetitive task and cache the result?Rob MarquardtDesigner/Resident WireheadToast Design800 Washington Avenue NorthMinneapolis MN 55401612.330.9863 v612.321.9424 fwww.toastdesign.com-------------------------------------------------------------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://search.smithmicro.com/
Associated Messages, from the most recent to the oldest:
On 8/15/00 6:19 pm, Stuart Tremain so noted...>I've rethought this:>>and come up with a workable solution:>>[text]NewSubTotal=[math]total=[lineitems]>[math]([quantity]*[price])*>[ShowIf [math]([weeks]/4)*[quantity][/math]<3]0.95[/ShowIf]>[ShowIf [math]([weeks]/4)*[quantity][/math]=3]0.9[/Showif]>[ShowIf [math]([weeks]/4)*[quantity][/math]=4]0.9[/Showif]>[ShowIf [math]([weeks]/4)*[quantity][/math]=5]0.9[/Showif]>[ShowIf [math]([weeks]/4)*[quantity][/math]=6]0.85[/Showif]>[ShowIf [math]([weeks]/4)*[quantity][/math]=7]0.85[/Showif]>[ShowIf [math]([weeks]/4)*[quantity][/math]=8]0.85[/Showif]>[ShowIf [math]([weeks]/4)*[quantity][/math]=9]0.8[/Showif]>[ShowIf [math]([weeks]/4)*[quantity][/math]=10]0.8[/Showif]>[ShowIf [math]([weeks]/4)*[quantity][/math]=11]0.8[/Showif]>[SHOWIF [math]([weeks]/4)*[quantity][/math]>11]0.75[/Showif]>[/math]>+[/lineitems]0[/math][/Text]Any time I do the same calculation more than once, I tend to give it its own variable.[text]NewSubTotal=[math]total=[lineitems][math show=f]w=([weeks]/4)*[quantity][/math][math]([quantity]*[price])*[ShowIf [w]<3]0.95[/ShowIf][ShowIf [w]=3]0.9[/Showif][ShowIf [w]=4]0.9[/Showif][ShowIf [w]=5]0.9[/Showif][ShowIf [w]=6]0.85[/Showif][ShowIf [w]=7]0.85[/Showif][ShowIf [w]=8]0.85[/Showif][ShowIf [w]=9]0.8[/Showif][ShowIf [w]=10]0.8[/Showif][ShowIf [w]=11]0.8[/Showif][ShowIf [w]>11]0.75[/Showif][/math]+[/lineitems]0[/math][/Text]... I wonder which has less overhead in the long run -- repeated [math] expressions, or the setting and recalling of the variables? Does WebCat recognize when it's performing a repetitive task and cache the result?Rob MarquardtDesigner/Resident WireheadToast Design800 Washington Avenue NorthMinneapolis MN 55401612.330.9863 v612.321.9424 fwww.toastdesign.com-------------------------------------------------------------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://search.smithmicro.com/
Rob Marquardt
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:
Forcing a NEWCART (1997)
[isfile] ? (1997)
[OT] HTML Table Cell Problem (2003)
UPS went bye bye (2006)
Categories (2000)
multiple databases (1997)
AW: AW: Credit card processing - UK (1997)
Problems getting parameters passed into email. (1997)
WebCat b13 CGI -shownext- (1997)
FORMS: Returning a specific page (1997)
Problems with date math (1997)
WebCatalog on Windows 98 (2000)
OFF TOPIC - sendmail problem (2003)
Multiple Passwords (1997)
[WebDNA] We don't want Big Brother any more (2008)
Re:2nd WebCatalog2 Feature Request (1996)
WC 2.0 frames feature (1997)
[random] only for 1-100??? (1997)
Authorize.net? (2003)
take me off mailing list please (2001)