[SMSI]Re: Price and Formula.db
This WebDNA talk-list message is from 2002
It keeps the original formatting.
numero = 45574
interpreted = N
texte = John,Thanks for the response.I believe the answer is yes (as I think you stated). I created a test store toplay around to look at the formulas.db.Here is the untouched formula from the test store (all one line of course).Name Formulaprice [text show=f&multi=t]foundOverride=F&actualPrice=[lookupdb=admin/products.db&lookInField=sku&value=[sku]&returnField=price][/text][formvariablesname=__&exact=f][searchdb=admin/related.db&eqR_IDdatarq=[value]&eqR_CATEGORYdatarq=[getcharsstart=3][name][/getchars]][founditems][ShowIf ![r_ovr_price]][textshow=f&multi=t]foundOverride=T&actualPrice=[r_ovr_price][/text][/ShowIf][/founditems][/search][/formvariables][actualPrice]There would be no reason for the formvariables loop if form vars couldn't bepassed in.>From the FILE FORMATS on-line docs:but you can still customize pricing by creating a formula to calculate a differentprice based on anyWebDNA tags, such as [username], [zip], or even a [math] calculation.****SCOTT****, (when you get a moment ;-) can you change the above to:but you can still customize pricing by creating a formula to calculate a differentprice based on anyWebDNA tags, such as [username], [zip], [math] calculation, or any form, text ormath variable that is active on that page.AND can you change:2.If Formulas.db contains a price formula, then evaluate the WebDNA expression(in the context of the current lineitem, so tags such as [price], [quantity], [zip] and [sku] are available).to2.If Formulas.db contains a price formula, then evaluate the WebDNA expression(in the context of the current lineitem, so tags such as [price], [quantity], [zip] and [sku] are available as well as any form, textor math variables active on that page).You could also state clearer that Since the formulas.db is a database there mustbe no carraige returns other than signifing line endings in the formula.a way around this could be using comments ([!][/!]) to hide extra carraigereturns. ie:--formula.inc--___________[if [username]=SCOTT][!][/!][then][math][_discount]*[lookupdb=products.db&lookInField=sku&value=[sku]&returnField=price][/math][/then][!][/!][else][lookupdb=products.db&lookInField=sku&value=[sku]&returnField=price][/else][/if].This is something we all learn but it is learned from the archives or the list andnot the docs.A quick search in the archives will show a record of the confussion the formulas.dbhas causedover the years. I remeber dealing with it a year and a half ago.Thanks,DonovanJohn Peacock wrote:> Donovan wrote:> > Can a variable be passed into a formulas.db other than the> > orderfile/lineitems and internal webcat> > variables?> >>> How would you expect to pass in a variable to the formulas? If you are using> the '?add' command and including an additional URL parameter, then the answer> is, I believe, no. Using a [addlineitem] context is much more likely to give> you the control you need.>> Formulas.db is only used (currently) when adding an item to the cart. As such,> it automatically gains access to the current orderfile header fields, any and> all fields from the database that is included as part of the add> command/context, all builtin webcat contexts, and AFAIK any and all active form> variables at that point on the page.>> To confirm this, add something like this to the price line in your formulas.db:>> [WriteFile SomeTextFile][FormVariables][index],[name],[value]
> [/FormVariables][/WriteFile]>> (obviously all as a single line). This will show you exactly what is available> for you to use within the formulas.db.>> HTH>> John>>-- ------------------------------------------------------------------------ ------------------------------------------------------------------------<><> Donovan Brooke <><>->ï ------------------------------------------------------------------------ -------------------------------------------------------------------------------------------------------------------------------------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:
John,Thanks for the response.I believe the answer is yes (as I think you stated). I created a test store toplay around to look at the formulas.db.Here is the untouched formula from the test store (all one line of course).Name Formulaprice [text show=f&multi=t]foundOverride=F&actualPrice=[lookupdb=admin/products.db&lookInField=sku&value=[sku]&returnField=price][/text][formvariablesname=__&exact=f][searchdb=admin/related.db&eqR_IDdatarq=[value]&eqR_CATEGORYdatarq=[getcharsstart=3][name][/getchars]][founditems][ShowIf ![r_ovr_price]][textshow=f&multi=t]foundOverride=T&actualPrice=[r_ovr_price][/text][/ShowIf][/founditems][/search][/formvariables][actualPrice]There would be no reason for the formvariables loop if form vars couldn't bepassed in.>From the FILE FORMATS on-line docs:but you can still customize pricing by creating a formula to calculate a differentprice based on anyWebDNA tags, such as [username], [zip], or even a [math] calculation.****SCOTT****, (when you get a moment ;-) can you change the above to:but you can still customize pricing by creating a formula to calculate a differentprice based on anyWebDNA tags, such as [username], [zip], [math] calculation, or any form, text ormath variable that is active on that page.AND can you change:2.If formulas.db contains a price formula, then evaluate the WebDNA expression(in the context of the current lineitem, so tags such as [price], [quantity], [zip] and [sku] are available).to2.If formulas.db contains a price formula, then evaluate the WebDNA expression(in the context of the current lineitem, so tags such as [price], [quantity], [zip] and [sku] are available as well as any form, textor math variables active on that page).You could also state clearer that Since the formulas.db is a database there mustbe no carraige returns other than signifing line endings in the formula.a way around this could be using comments ([!][/!]) to hide extra carraigereturns. ie:--formula.inc--___________[if [username]=SCOTT][!][/!][then][math][_discount]*[lookupdb=products.db&lookInField=sku&value=[sku]&returnField=price][/math][/then][!][/!][else][lookupdb=products.db&lookInField=sku&value=[sku]&returnField=price][/else][/if].This is something we all learn but it is learned from the archives or the list andnot the docs.A quick search in the archives will show a record of the confussion the formulas.dbhas causedover the years. I remeber dealing with it a year and a half ago.Thanks,DonovanJohn Peacock wrote:> Donovan wrote:> > Can a variable be passed into a formulas.db other than the> > orderfile/lineitems and internal webcat> > variables?> >>> How would you expect to pass in a variable to the formulas? If you are using> the '?add' command and including an additional URL parameter, then the answer> is, I believe, no. Using a [addlineitem] context is much more likely to give> you the control you need.>> formulas.db is only used (currently) when adding an item to the cart. As such,> it automatically gains access to the current orderfile header fields, any and> all fields from the database that is included as part of the add> command/context, all builtin webcat contexts, and AFAIK any and all active form> variables at that point on the page.>> To confirm this, add something like this to the price line in your formulas.db:>> [WriteFile SomeTextFile][formvariables][index],[name],[value]
> [/FormVariables][/WriteFile]>> (obviously all as a single line). This will show you exactly what is available> for you to use within the formulas.db.>> HTH>> John>>-- ------------------------------------------------------------------------ ------------------------------------------------------------------------<><> Donovan Brooke <><>->ï ------------------------------------------------------------------------ -------------------------------------------------------------------------------------------------------------------------------------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/
Donovan
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:
what the... (2004)
Replacing a Word (1999)
[WebDNA] Code Library (2013)
webcat NT with [dos] command (1997)
Odd Cart Behavior (1997)
Macauth: Dates and No Scripting... (1997)
[format xs] freeze (1997)
Can't Update records (1997)
(1997)
RePost: NAT and the CART (1999)
WC2f3 (1997)
Wanted: More Math Functions (or, Can You Solve This?) (1997)
emailer and bad addresses (1997)
WebCatalog NT beta 18 problem (1997)
re: Large databases in WebCat (1997)
First postarg not taking in $Commands (1997)
Bug Report, maybe (1997)
Emailer 1.0.2 Conflicts? (1998)
Can WebDNA do this? (2000)
Out of the woodwork (2007)