numero = 21838
interpreted = N
texte = CourierHi allIs it possible to use formulas.db to compute values other than price,unitshipcost,taxrate etc... and have your own formulas in there. Forinstance in this project I have ship costs based on weight, andsubtotal (the subtotal of the items that aren't weight based). Icalculate the total weight and total non-weight subtotal with thissnippet from shopingcart.tpl....<<This works, so now I want to get values for the weight ship total andthe Price ship total. I would like to be able to drop [weightshiptotal] and [priceshiptotal] onto invoice.tpl.So I figured I could just write this into formulas.db[priceshiptotal]`tab'[showif [priceship]<<101][searchdb=sub100a.db&wostatedatarq=[shiptostate]&lesubdatarq=[shipsub]&subsdir=ds&subsort=1&subtype=num&max=1][founditems][cost][/founditems][/search][/showif][showif [priceship]>100][searchdb=100plus.db&wostatedatarq=[shiptostate]&lesubdatarq=[shipsub]&subsdir=ds&subsort=1&subtype=num&max=1][founditems][cost][/founditems][/search][/showif]and also this...[weightshiptotal]~tab [searchdb=weight.db&wostatedatarq=[shiptostate]&leweightdatarq=[weightshiptotal]&weightsort=1&weightsdir=de&weighttype=num&max=1][founditems][cost][/founditems][/search]No joy though, however if I change [priceshiptotal] in formulas.db toshipCost it works fine ie...shipCost [showif [priceship]<<101][searchdb=sub100a.db&wostatedatarq=[shiptostate]&lesubdatarq=[shipsub]&subsdir=ds&subsort=1&subtype=num&max=1][founditems][cost][/founditems][/search][/showif][showif [priceship]>100][searchdb=100plus.db&wostatedatarq=[shiptostate]&lesubdatarq=[shipsub]&subsdir=ds&subsort=1&subtype=num&max=1][founditems][cost][/founditems][/search][/showif][showif [priceship]>100]The only problem is I need both the priceshiptotal and theweightshiptotal so I can display them and so I can make grandTotal [math][grandtotal]+weightshiptotal]+[priceshiptotal][/math]Should these custom formulas be working in Version 2.1 and I shouldjust scour the code for a little mistake, or is formulas.db notdesigned to do this and I should look for another way.Help is appreciatedTim
Associated Messages, from the most recent to the oldest:
CourierHi allIs it possible to use formulas.db to compute values other than price,unitshipcost,taxrate etc... and have your own formulas in there. Forinstance in this project I have ship costs based on weight, andsubtotal (the subtotal of the items that aren't weight based). Icalculate the total weight and total non-weight subtotal with thissnippet from shopingcart.tpl....<[math][lineitems]([weight]*[quantity])+[/lineitems]0[/math]><[math][lineitems][hideif[weight]!]([price]*[quantity])+[/hideif][/lineitems]0[/math]>This works, so now I want to get values for the weight ship total andthe Price ship total. I would like to be able to drop [weightshiptotal] and [priceshiptotal] onto invoice.tpl.So I figured I could just write this into formulas.db[priceshiptotal]`tab'[showif [priceship]<<101][searchdb=sub100a.db&wostatedatarq=[shiptostate]&lesubdatarq=[shipsub]&subsdir=ds&subsort=1&subtype=num&max=1][founditems][cost][/founditems][/search][/showif][showif [priceship]>100][searchdb=100plus.db&wostatedatarq=[shiptostate]&lesubdatarq=[shipsub]&subsdir=ds&subsort=1&subtype=num&max=1][founditems][cost][/founditems][/search][/showif]and also this...[weightshiptotal]~tab [searchdb=weight.db&wostatedatarq=[shiptostate]&leweightdatarq=[weightshiptotal]&weightsort=1&weightsdir=de&weighttype=num&max=1][founditems][cost][/founditems][/search]No joy though, however if I change [priceshiptotal] in formulas.db toshipCost it works fine ie...shipCost [showif [priceship]<<101][searchdb=sub100a.db&wostatedatarq=[shiptostate]&lesubdatarq=[shipsub]&subsdir=ds&subsort=1&subtype=num&max=1][founditems][cost][/founditems][/search][/showif][showif [priceship]>100][searchdb=100plus.db&wostatedatarq=[shiptostate]&lesubdatarq=[shipsub]&subsdir=ds&subsort=1&subtype=num&max=1][founditems][cost][/founditems][/search][/showif][showif [priceship]>100]The only problem is I need both the priceshiptotal and theweightshiptotal so I can display them and so I can make grandTotal [math][grandtotal]+weightshiptotal]+[priceshiptotal][/math]Should these custom formulas be working in Version 2.1 and I shouldjust scour the code for a little mistake, or is formulas.db notdesigned to do this and I should look for another way.Help is appreciatedTimTim Taylor
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...