THANKS!!! Re: ShipCosts.db and debugging

This WebDNA talk-list message is from

1997


It keeps the original formatting.
numero = 12854
interpreted = N
texte = Grant,Thanks for the late-nite response to my query (read: my nearly desparate plea for help!). Everything works fine now! I think there may have been 2 problems:1) an error in my ShipCost formula (although, for the life of me, I couldn't see any character-for-character difference when compared to the one you emailed); and2) a problem with the Shipcosts.db (there must have been an additional tab or CR somewhere!)Thanks for the debugging advice as well! My snips were working...but I wasn't getting anything when the entire formula was strung together. Which leads to my next question about debugging...can you provide some more details regarding the syntax errors you warned against (such as 1+A or 5- or the elusive 1+)? Also, is there any documentation for ShippingTotal tag...yes, I did assume it's (sum of unitShipCost's + shipCost)?Thanks again for putting 2 days of frustration to end! Dale dstokdyk@dvs.mv.comp.s. -- here's the rest of the dialog for the public talk list:-------------------------------------------------------- Grant Hulbert wrote: > > But....what I need the formula to do is add all the weights, *then* look > up the corresponding cost! I think what I need is a new variable, > something like SumWeights, then use your formula to lookup the cost for > NextDay or Ground by SumWeights.You can sum the weights right in the math formula:[math][lineitems][weight]+[/lineitems]0[/math]use that instead of just [weight], which would only use the one weight you just added to the cart. Dale wrote:Thanks again, Grant! But I ran off the road somewhere....Before I try adding the math calculation for total shipping weight (below), I need some help in getting the original formula to work for shipCosts:[lookup db=shipcosts.db&lookInField=weight&value=[weight}&returnField=[shipVia]}I realized this morning that I had some other funky stuff going on with my shipping cost calculations...namely, that numbers I had thrown in to test the unitShipCost field were throwing off the number. I think because I was using the totalShippingCosts tag (from the General Store example). (BTW--couldn't find documentation for totalShippingCosts, although I believe it's supposesd to add shipCosts and unitShipCosts, right?)So...to cut to the chase...I'm using [shipCosts] in my Invoice.tmpl, but am getting no output (I set shipCosts equal to the formula in the formulas.db.--this is OK, right?)Am trying to debug by throwing snips into the ShoppingCart.tmpl, and am seeing:* weight for each item * total weights * but nothing for the lookup formula aboveCan you provide some advice on further debugging? It's as if the shipCosts db. didn't exist (it shows up fine in ADMIN)!?! Grant Hulbert wrote:> When you get no output from a [math] context, that means it has a syntax error in it, such as 1+A or 5- or the elusive 1+, where is an accidental carriage return from an include file or some other source. > > >[lookup db=shipcosts.db&lookInField=weight&value=[weight}&returnField=[shipVia]} > >* but nothing for the lookup formula above > > If you are truly using this formula, the curly-braces are a no-no. I also notice you are adding 's' to the end of many tags, where no 's' truly exists. > > >Can you provide some advice on further debugging? It's as if the > >shipCosts db. didn't exist (it shows up fine in ADMIN)!?! > > Start by putting the equation into your shopping cart page, so you can see the output of what will eventually go into the formula database: > > shipVia: [shipVia]
> > list of weights: [lineItems][lookup db=catalog.txt&lookInField=sku&value=[sku]&returnField=weight],[/lineItems]
> > sum of weights: [math][lineItems][lookup db=catalog.txt&lookInField=sku&value=[sku]&returnField=weight]+[/lineItems]0[/math]
> > desired shipCost: [lookup db=shipcosts.db&lookInField=weight&value=[math][lineItems][lookup db=catalog.txt&lookInField=sku&value=[sku]&returnField=weight]+[/lineItems]0[/math]&returnField=[shipVia]] > > And then, once you're happy with the results, you can paste that formula into the shipCost database (remember at this point you should zero out any unitShipCost values you might have in your product catalog, because the assumption is (sum of unitShipCost's + shipCost), and we're setting up a formula here that includes all the costs into the one shipCost variable. > > -- formulas.db -- > shipCost [lookup db=shipcosts.db&lookInField=weight&value=[math][lineItems][lookup db=catalog.txt&lookInField=sku&value=[sku]&returnField=weight]+[/lineItems]0[/math]&returnField=[shipVia]] > > I haven't tried any of these formulas out, because my wife is calling me to sleep, but it's the general idea. > > If this stuff works, please post it to the public talk list so everyone can learn. Associated Messages, from the most recent to the oldest:

    
Grant,Thanks for the late-nite response to my query (read: my nearly desparate plea for help!). Everything works fine now! I think there may have been 2 problems:1) an error in my ShipCost formula (although, for the life of me, I couldn't see any character-for-character difference when compared to the one you emailed); and2) a problem with the Shipcosts.db (there must have been an additional tab or CR somewhere!)Thanks for the debugging advice as well! My snips were working...but I wasn't getting anything when the entire formula was strung together. Which leads to my next question about debugging...can you provide some more details regarding the syntax errors you warned against (such as 1+A or 5- or the elusive 1+)? Also, is there any documentation for ShippingTotal tag...yes, I did assume it's (sum of unitShipCost's + shipCost)?Thanks again for putting 2 days of frustration to end! Dale dstokdyk@dvs.mv.comp.s. -- here's the rest of the dialog for the public Talk List:-------------------------------------------------------- Grant Hulbert wrote: > > But....what I need the formula to do is add all the weights, *then* look > up the corresponding cost! I think what I need is a new variable, > something like SumWeights, then use your formula to lookup the cost for > NextDay or Ground by SumWeights.You can sum the weights right in the math formula:[math][lineitems][weight]+[/lineitems]0[/math]use that instead of just [weight], which would only use the one weight you just added to the cart. Dale wrote:Thanks again, Grant! But I ran off the road somewhere....Before I try adding the math calculation for total shipping weight (below), I need some help in getting the original formula to work for shipCosts:[lookup db=shipcosts.db&lookInField=weight&value=[weight}&returnField=[shipVia]}I realized this morning that I had some other funky stuff going on with my shipping cost calculations...namely, that numbers I had thrown in to test the unitShipCost field were throwing off the number. I think because I was using the totalShippingCosts tag (from the General Store example). (BTW--couldn't find documentation for totalShippingCosts, although I believe it's supposesd to add shipCosts and unitShipCosts, right?)So...to cut to the chase...I'm using [shipCosts] in my Invoice.tmpl, but am getting no output (I set shipCosts equal to the formula in the formulas.db.--this is OK, right?)Am trying to debug by throwing snips into the ShoppingCart.tmpl, and am seeing:* weight for each item * total weights * but nothing for the lookup formula aboveCan you provide some advice on further debugging? It's as if the shipCosts db. didn't exist (it shows up fine in ADMIN)!?! Grant Hulbert wrote:> When you get no output from a [math] context, that means it has a syntax error in it, such as 1+A or 5- or the elusive 1+, where is an accidental carriage return from an include file or some other source. > > >[lookup db=shipcosts.db&lookInField=weight&value=[weight}&returnField=[shipVia]} > >* but nothing for the lookup formula above > > If you are truly using this formula, the curly-braces are a no-no. I also notice you are adding 's' to the end of many tags, where no 's' truly exists. > > >Can you provide some advice on further debugging? It's as if the > >shipCosts db. didn't exist (it shows up fine in ADMIN)!?! > > Start by putting the equation into your shopping cart page, so you can see the output of what will eventually go into the formula database: > > shipVia: [shipVia]
> > list of weights: [lineitems][lookup db=catalog.txt&lookInField=sku&value=[sku]&returnField=weight],[/lineItems]
> > sum of weights: [math][lineitems][lookup db=catalog.txt&lookInField=sku&value=[sku]&returnField=weight]+[/lineItems]0[/math]
> > desired shipCost: [lookup db=shipcosts.db&lookInField=weight&value=[math][lineitems][lookup db=catalog.txt&lookInField=sku&value=[sku]&returnField=weight]+[/lineItems]0[/math]&returnField=[shipVia]] > > And then, once you're happy with the results, you can paste that formula into the shipCost database (remember at this point you should zero out any unitShipCost values you might have in your product catalog, because the assumption is (sum of unitShipCost's + shipCost), and we're setting up a formula here that includes all the costs into the one shipCost variable. > > -- formulas.db -- > shipCost [lookup db=shipcosts.db&lookInField=weight&value=[math][lineitems][lookup db=catalog.txt&lookInField=sku&value=[sku]&returnField=weight]+[/lineItems]0[/math]&returnField=[shipVia]] > > I haven't tried any of these formulas out, because my wife is calling me to sleep, but it's the general idea. > > If this stuff works, please post it to the public Talk List so everyone can learn. Dale Stokdyk

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:

Cart questions (1997) HELP WITH DATES (1997) WebCat2b13 Mac plugin - [sendmail] and checkboxes (1997) Secure Web Server (1999) [WebDNA] WebDNA hosting (2012) Adding headers to email (1997) [WebDNA] Emerging from the Shell (was: unique words) (2009) [SHOWIF] (1997) Version f1 status (1997) japanese characters (1997) Highlighting words found in a keyword search (2003) syntax question, not in online refernce (1997) [Price] (1997) OT: looking for help creating a masked image with Photoshop orFireworks (2002) Show shoppingcart after remove last item (1997) WebCat2b15MacPlugin - [protect] (1997) restarting service remotely on NT (1997) [sendmail] questions... (1997) country of origin from IPADDRESS??? (2001) WebMerchant when CC network is down (1998)