Re: Help on how to store calculated value
This WebDNA talk-list message is from 2002
It keeps the original formatting.
numero = 45432
interpreted = N
texte = Eric -If your initial calculation is indeed giving you the right calculated value, then the code for it is fine and you just need to get the result assigned to a math variable. Your math syntax, including the [lineitems]+[lookup... looks fine to me, as long as you are within an orderfile context.You may very well be within an IMPLIED orderfile context even if there is no [orderfile] tag on your page - WebDNA automatically invokes an orderfile context around a page when certain parameters are passed in.A simplified syntax for setting a math variable is:[math show=F]var=1+2[/math]Anywhere after that, specifying [var] will return 3.So, use:[math show=F]BW=0[lineitems]+[lookup db=admin/products.db&lookinfield=SKU&value=[url][sku][/url]&returnfield=WEIGHT]*[quantity][/lineitems][/math]then [BW] will hold your calculated value.You DO NOT need to add [orderfile cart=[cart]] to your page if the calculation is already working - this may very well foul things up by creating a new empty order file.- brianAt 9:12 PM -0600 11/18/02, Eric wrote:>Hi,>>I know this is easy but somehow I am brain dead.>>I have the following calculation and it gives the correct value>>[math]0[lineitems]+[lookup >db=admin/products.db&lookinfield=SKU&value=[url][sku][/url]&returnfield=WEIGHT]*[quantity][/lineitems][/math]>>I wish to store the results in a field (to be called BW) so that I >can use this field to display the calculated data and for further >calculation.>>I use>>[BW]=[math]0[lineitems]+[lookup >db=admin/products.db&lookinfield=SKU&value=[url][sku][/url]&returnfield=WEIGHT]*[quantity][/lineitems][/math]>>But it did not work.>>Can someone help??>>>Stuart suggested to use the following,>>>>[Orderfile file=file]>[Math show=F]BW=0[lineitems]+([lookup>db=admin/products.db&lookinfield=SKU&value=[url][sku][/ >url]&returnfield=WEIGHT]*[quantity])[/lineitems][/Math]>[/OrderFile]>>Then when you need the value call the Math variable ....>>Here is the total weight = [BW]>>>>but it did not work and gives the following error message:>>Error: Can't open order file. Ignoring [OrderFile] context>>>>>>>>>>>------------------------------------------------------------->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/-------------------------------------------------------------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:
Eric -If your initial calculation is indeed giving you the right calculated value, then the code for it is fine and you just need to get the result assigned to a math variable. Your math syntax, including the [lineitems]+[lookup... looks fine to me, as long as you are within an orderfile context.You may very well be within an IMPLIED orderfile context even if there is no [orderfile] tag on your page - WebDNA automatically invokes an orderfile context around a page when certain parameters are passed in.A simplified syntax for setting a math variable is:[math show=F]var=1+2[/math]Anywhere after that, specifying [var] will return 3.So, use:[math show=F]BW=0[lineitems]+[lookup db=admin/products.db&lookinfield=SKU&value=[url][sku][/url]&returnfield=WEIGHT]*[quantity][/lineitems][/math]then [BW] will hold your calculated value.You DO NOT need to add [orderfile cart=[cart]] to your page if the calculation is already working - this may very well foul things up by creating a new empty order file.- brianAt 9:12 PM -0600 11/18/02, Eric wrote:>Hi,>>I know this is easy but somehow I am brain dead.>>I have the following calculation and it gives the correct value>>[math]0[lineitems]+[lookup >db=admin/products.db&lookinfield=SKU&value=[url][sku][/url]&returnfield=WEIGHT]*[quantity][/lineitems][/math]>>I wish to store the results in a field (to be called BW) so that I >can use this field to display the calculated data and for further >calculation.>>I use>>[BW]=[math]0[lineitems]+[lookup >db=admin/products.db&lookinfield=SKU&value=[url][sku][/url]&returnfield=WEIGHT]*[quantity][/lineitems][/math]>>But it did not work.>>Can someone help??>>>Stuart suggested to use the following,>>>>[Orderfile file=file]>[Math show=F]BW=0[lineitems]+([lookup>db=admin/products.db&lookinfield=SKU&value=[url][sku][/ >url]&returnfield=WEIGHT]*[quantity])[/lineitems][/Math]>[/OrderFile]>>Then when you need the value call the Math variable ....>>Here is the total weight = [BW]>>>>but it did not work and gives the following error message:>>Error: Can't open order file. Ignoring [orderfile] context>>>>>>>>>>>------------------------------------------------------------->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/-------------------------------------------------------------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:
RequiredFields notes ... (1997)
Beta 18 (1997)
[INCLUDE] Limitations (1998)
using showpage and showcart commands (1996)
Re:no [search] with NT (1997)
I forgot (1998)
Generating Options for a Form. (1997)
foreign character sets and conversions (1998)
(2000)
Searching for words equal to A or equal to B (1999)
Trouble with formula.db + more explanation (1997)
How to unsubscribe (2001)
unsubscribe (2000)
problems with WebCat-Plugin ()
info (1997)
Color options for items (1999)
Special delete ... (1997)
Bug (feature) in v6 listfiles shows hidden files ... (2004)
strange problem listfiles and movefile (long) (2000)
RE: Nested [SEARCH] and [REPLACE] problem. (1997)