Re: shipping & multiple comparisons?
This WebDNA talk-list message is from 2000
It keeps the original formatting.
numero = 32748
interpreted = N
texte = I guess the first question should be WHY? Are you a glutton for punish-ment or do you just like pain? ;~)Seriously though, the whole point (IMNSHO) of WebCatalog is the built-ine-commerce functionality. If you Read The Fine Manual, specifically thepages on Formulas and Order File (both on the File Formats tab), you will discover that the header field shipCost is a order-wide shipping cost (go figure).You can either create a formula entry or a form variable or if all elsefails use [setheader] to update the shipCost value, which will then correctly add to the subtotal as you expect.You also seem to have fallen for the common trap of using [text] ratherthan [math] for your variables. If you intend to perform math on avariable, you need to define it as a [math] variable. This is just ascommon as the person who uses [math] for things that need to be [text].So, to start with (inside a orderfile context): [math]ship=0[lineitems]+[quantity][/lineitems][/math]will get you the number of line items.Now use the following formula (formatted for readability only):[showif [ship]>5] [math][subtotal]*.15[/math][showif][hideif [ship]>5] [math]0+[showif [ship]<3] 4.5[/showif][!]good for 1,2[/!] [showif [ship]<6]+1.5[/showif][!]good for 3,4,5[/!] [/math][/hideif]This will be easier with 4.0 of course. In any case, this will returnthe shipCost at any given point. This can be either inserted directlyinto the formulas.db or assigned to a math variable called shipcost. You can also update the head manually (if you like pain ;~).I hope this helps to see that there is more than one way to do it, andbreaking the problem into little steps makes it easier.John Peacockp.s. IMNSHO = In My Not So Humble OpinionParker wrote:> > trying to get the following to work as replacement for> [grandtotal]. [ship] is [text]ship=[math]0[lineitems]+[quantity][/lineitems][/math][/text]> which works great:> > [showif [ship]<3][math][subtotal]+4.50[/math][/showif]> [showif [ship]^3,4,5][math][subtotal]+6.00][/math][/showif]> [showif [ship]>5][math][subtotal]*.15[/math][/showif]> > <3 and >5 works fine obviously, but I'm having trouble with> multiple comparisons ala the middle one... I also tried> splitting them up like:> > [showif [ship]=3][math][subtotal]+6.00][/math][/showif]> [showif [ship]=4][math][subtotal]+6.00][/math][/showif]> [showif [ship]=5][math][subtotal]+6.00][/math][/showif]> > but that just displays 0 for some reason... I'm close, but> what do I need to get that 3-5 to work at $6.00?? Thanks and> forgive if this is obvious.. I couldn't find what I need in> the list archives or docs yet on inclusive comparisons etc.-------------------------------------------------------------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:
I guess the first question should be WHY? Are you a glutton for punish-ment or do you just like pain? ;~)Seriously though, the whole point (IMNSHO) of WebCatalog is the built-ine-commerce functionality. If you Read The Fine Manual, specifically thepages on Formulas and order file (both on the File Formats tab), you will discover that the header field shipCost is a order-wide shipping cost (go figure).You can either create a formula entry or a form variable or if all elsefails use [setheader] to update the shipCost value, which will then correctly add to the subtotal as you expect.You also seem to have fallen for the common trap of using [text] ratherthan [math] for your variables. If you intend to perform math on avariable, you need to define it as a [math] variable. This is just ascommon as the person who uses [math] for things that need to be [text].So, to start with (inside a orderfile context): [math]ship=0[lineitems]+[quantity][/lineitems][/math]will get you the number of line items.Now use the following formula (formatted for readability only):[showif [ship]>5] [math][subtotal]*.15[/math][showif][hideif [ship]>5] [math]0+[showif [ship]<3] 4.5[/showif][!]good for 1,2[/!] [showif [ship]<6]+1.5[/showif][!]good for 3,4,5[/!] [/math][/hideif]This will be easier with 4.0 of course. In any case, this will returnthe shipCost at any given point. This can be either inserted directlyinto the formulas.db or assigned to a math variable called shipcost. You can also update the head manually (if you like pain ;~).I hope this helps to see that there is more than one way to do it, andbreaking the problem into little steps makes it easier.John Peacockp.s. IMNSHO = In My Not So Humble OpinionParker wrote:> > trying to get the following to work as replacement for> [grandtotal]. [ship] is [text]ship=[math]0[lineitems]+[quantity][/lineitems][/math][/text]> which works great:> > [showif [ship]<3][math][subtotal]+4.50[/math][/showif]> [showif [ship]^3,4,5][math][subtotal]+6.00][/math][/showif]> [showif [ship]>5][math][subtotal]*.15[/math][/showif]> > <3 and >5 works fine obviously, but I'm having trouble with> multiple comparisons ala the middle one... I also tried> splitting them up like:> > [showif [ship]=3][math][subtotal]+6.00][/math][/showif]> [showif [ship]=4][math][subtotal]+6.00][/math][/showif]> [showif [ship]=5][math][subtotal]+6.00][/math][/showif]> > but that just displays 0 for some reason... I'm close, but> what do I need to get that 3-5 to work at $6.00?? Thanks and> forgive if this is obvious.. I couldn't find what I need in> the list archives or docs yet on inclusive comparisons etc.-------------------------------------------------------------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/
John Peacock
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:
listdatabases,flushdatabases Mac Webstar beta issues (2000)
WebCatalog as a ListServ (1998)
WebCat2b13MacPlugIn - [showif][search][/showif] (1997)
WebCatalog 2.0 b 15 mac (1997)
Sort Order on a page search (1997)
Claris HomePage messes up the code (1997)
Caching [include] files ... (1997)
2.01 upgrade problems (1997)
Database Upload (2000)
Relay link (2002)
format problem on NT? (1997)
WebCat2: Items xx to xx shown, etc. (1997)
Suddenly can't see files... (2000)
Change in Host? (1999)
Comments in db? (1997)
Extract my page name (2006)
How do I pass [cart] when user clicks back (2000)
[WebDNA] Carriage Return/Line Feed Issue (2009)
WC2b15 File Corruption (1997)
carts on MacOS X Server (2000)