Re: Formulas.db
This WebDNA talk-list message is from 2001
It keeps the original formatting.
numero = 40356
interpreted = N
texte = I haven't tried it, but couldn't you set a text variable within a formula? As I understand it, WebCat basically grabs the formula from the DB then does an [interpret] on it... so, theoretically, you could put any DNA code you want there - including [text]textVar=blah[/text] - as long as you are careful that the resulting value has no extra characters after it's been interpreted.Also, a clarification: the entry in the formulas.db must be on one line, and the results of the interpreted include file must not contain any characters besides the desired result (no spaces or returns...), but the code within the include file could be on multiple lines for readability, as long as you comment out all the return characters and other extraneous text.- BrianAt 8:55 PM 11/26/2001, John Peacock wrote:>Donovan Brooke wrote:>>>Hello again,>>Anyone ready to delve into the depths of Price Formulas?>>>>this might the first of perhaps a few questions regarding >>Formulas.db...(another item I think is>>under covered in the docs...no offence, grant, jay, john and Scott >>:-) I will have a few complex discounts going on.>>Here is my first question that I can't find the answer to. (btw, >>I'll try to keep the questions in this same thread)>>>>Can a variable be passed from the formulas.db to the page that will >>get the price?>>>No. Any line in the formulas.db is used strictly to return a single >value (it is like a [lookup] in that way) which is used to set a >specific field in the cart.>>>>>Here is the beginnings of one of my discounts (un verified). It is >>a discount that is given if the product is in a certain>>category And, if it is a certain time of the year. The year part I >>haven't implimented yet.>>>>[showif [url][lookup >>db=products.db&lookInField=sku&value=[sku]&returnField=CATEGORY][/url]=TFP >>Tax>>Forms][text]subprice=[math][lookup>>db=products.db&lookInField=sku&value=[sku]&returnField=PRICE][/text][text]disc=[math][subprice]*.1[/math][/text][math][subprice]-[dis][/math][/showif]>>>Always debug your formulas in a standard template; You will find out >more by breaking down the formula into bite size pieces on a page >you can see. Once you have the value you want, combine the lines on >the page into a single line which you can put into the formulas.db.>>NOTE: the use of quotes in [showif] is unnecessary. In [if] >statements, the quotes force the terms to be compared as strings.>>>>>This is more than one line in this email but it is only one line in >>my db of course. My problem is that I need to come>>up with a different strategy if I am going to incorporate all my >>discounts. (the one line would very long) How are people doing>>this?>>>>Can I use [include file=] within a .db value?>>>If you mean inside a formulas.db entry, yes, I think people have had >success (remember that it must still be on one line).>John>>-->John Peacock>Director of Information Research and Technology>Rowman & Littlefield Publishing Group>4720 Boston Way>Lanham, MD 20706>301-459-3366 x.5010>fax 301-429-5747-------------------------------------------------------------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 haven't tried it, but couldn't you set a text variable within a formula? As I understand it, WebCat basically grabs the formula from the DB then does an [interpret] on it... so, theoretically, you could put any DNA code you want there - including [text]textVar=blah[/text] - as long as you are careful that the resulting value has no extra characters after it's been interpreted.Also, a clarification: the entry in the formulas.db must be on one line, and the results of the interpreted include file must not contain any characters besides the desired result (no spaces or returns...), but the code within the include file could be on multiple lines for readability, as long as you comment out all the return characters and other extraneous text.- BrianAt 8:55 PM 11/26/2001, John Peacock wrote:>Donovan Brooke wrote:>>>Hello again,>>Anyone ready to delve into the depths of Price Formulas?>>>>this might the first of perhaps a few questions regarding >>formulas.db...(another item I think is>>under covered in the docs...no offence, grant, jay, john and Scott >>:-) I will have a few complex discounts going on.>>Here is my first question that I can't find the answer to. (btw, >>I'll try to keep the questions in this same thread)>>>>Can a variable be passed from the formulas.db to the page that will >>get the price?>>>No. Any line in the formulas.db is used strictly to return a single >value (it is like a [lookup] in that way) which is used to set a >specific field in the cart.>>>>>Here is the beginnings of one of my discounts (un verified). It is >>a discount that is given if the product is in a certain>>category And, if it is a certain time of the year. The year part I >>haven't implimented yet.>>>>[showif [url][lookup >>db=products.db&lookInField=sku&value=[sku]&returnField=CATEGORY][/url]=TFP >>Tax>>Forms][text]subprice=[math][lookup>>db=products.db&lookInField=sku&value=[sku]&returnField=PRICE][/text][text]disc=[math][subprice]*.1[/math][/text][math][subprice]-[dis][/math][/showif]>>>Always debug your formulas in a standard template; You will find out >more by breaking down the formula into bite size pieces on a page >you can see. Once you have the value you want, combine the lines on >the page into a single line which you can put into the formulas.db.>>NOTE: the use of quotes in [showif] is unnecessary. In [if] >statements, the quotes force the terms to be compared as strings.>>>>>This is more than one line in this email but it is only one line in >>my db of course. My problem is that I need to come>>up with a different strategy if I am going to incorporate all my >>discounts. (the one line would very long) How are people doing>>this?>>>>Can I use [include file=] within a .db value?>>>If you mean inside a formulas.db entry, yes, I think people have had >success (remember that it must still be on one line).>John>>-->John Peacock>Director of Information Research and Technology>Rowman & Littlefield Publishing Group>4720 Boston Way>Lanham, MD 20706>301-459-3366 x.5010>fax 301-429-5747-------------------------------------------------------------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/
Brian Fries
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:
Writing [raw] to a file (2000)
WebCatalog for Dummies part 2 (2000)
Permission denied? (2004)
AAgghh!! Help, please. SSL strikes again. (1997)
[WebDNA] Timer (2009)
Install Webcatalog under NT4.0 and Microsoft IIS 2.0 (1997)
Parameter Problem (1998)
Accentuated and non-English letters (2002)
[random] only for 1-100??? (1997)
Associative lookup style? + bit more (1997)
The force has left me. (2002)
[append] and SSL (1997)
lineitem variables (1999)
[recordrank]? (2000)
Re:Emailer and encryption (1997)
[showif]/[hideif] question (1997)
Re:Emailer and encryption (1997)
RAM variables (1997)
Upload (1998)
Error reading data -1 (1997)