Re: [BULK] Re: [WebDNA] [if] or [case] or something else
This WebDNA talk-list message is from 2012
It keeps the original formatting.
numero = 110031
interpreted = N
texte = Nope. That confused me too when I did this the first time.for the row of 5,9,.02 and a comparison value of 7:7 is greater then or equal to 5 (match)AND (the rq tag after each search operator)7 is less then or equal to 9. (match)assuming your dataset is properly ranged (no overlapping ranges) this =should return 1 match.your way would read:7 is less then or equal to 5 (nope) (it would match the next row (10) =and all subsequent rows but fail the AND joiner.)AND7 is greater then or equal to 9 (nope).For fun and enjoyment, one evening (or week) develop a pricing engine =that takes into account multiple price levels (retail, dealer, =distributor, government, etc), customer specify prices, quantity =discounts (for all of the above), promotional pricing (with start and =end dates, also only available to some price levels) and silly price =promotion coupons (buy 2 items in a category, get the 3rd (maybe =different sku but in the same category) free). Yeah, good times... good =times. As I recall I had hair when I started that project.On Dec 13, 2012, at 5:06 PM, Terry Nair
wrote:> Should it not be ....>=20> [text]howmany=3D7[/text]> [search> =table=3Dqtydiscount&leLOWdatarq=3D[howmany]&geHIGHdatarq=3D[howmany]&max=3D=1][foundi> tems][discount][/founditems][/search]>=20> The "le" and "ge" switch places so that with the value 7, it targets =the> correct row of 5,9,.02>=20> Cheers TDn>=20> -----Original Message-----> From: Brian B. Burton [mailto:brian@burtons.com]=20> Sent: Friday, December 14, 2012 01:42> To: talk@webdna.us> Subject: [BULK] Re: [WebDNA] [if] or [case] or something else> Importance: Low>=20> another way to deal with this is to use a table (or database) and =search> function.>=20> [table name=3Dqtydiscount&fields=3Dlow,high,discount] [!] tabs have =been> replaced with commas for readability, code won't work like this [/!]> 1,4,.00> 5,9,.02> 10,19,.03> 20,29,.04> 30,9999,.05> [/table]>=20> [text]howmany=3D7[/text]> [search> =table=3Dqtydiscount&geLOWdatarq=3D[howmany]&leHIGHdatarq=3D[howmany]&max=3D=1][foundi> tems][discount][/founditems][/search]>=20>=20>=20> A tip of the hat to Grant Hulbert, who taught me this method a very =very> long time ago.=20>=20> Brian B. Burton>=20> On Dec 13, 2012, at 10:13 AM, Steve Craig wrote:>=20>> Hi All>>=20>> I have a little problem that I'm hoping someone cane help with or at =least> point me in the correct direction.>>=20>> I have a list of prices, if the price lies in a particular range I do =one> set of maths, if it lies in a different range I do a different thing =etc> etc.=20>>=20>> <650 then set x to 120>> =3D>650 and < 800 set x to 110>> =3D>800 and < 950 set x to 100>> ....>> ....>> ....>>> 1550 set x to 50>>=20>> What is the best way to code it, using if then or using switch? If =it's> switch then what is the syntax of the case bit? Or maybe a different =way?>>=20>> Any help much appreciated.>>=20>=20>=20> ---------------------------------------------------------> This message is sent to you because you are subscribed to the mailing =list> .> To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us> Bug Reporting: support@webdna.us>=20> ---------------------------------------------------------> This message is sent to you because you are subscribed to> the mailing list .> To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us> Bug Reporting: support@webdna.us>=20
Associated Messages, from the most recent to the oldest:
Nope. That confused me too when I did this the first time.for the row of 5,9,.02 and a comparison value of 7:7 is greater then or equal to 5 (match)AND (the rq tag after each search operator)7 is less then or equal to 9. (match)assuming your dataset is properly ranged (no overlapping ranges) this =should return 1 match.your way would read:7 is less then or equal to 5 (nope) (it would match the next row (10) =and all subsequent rows but fail the AND joiner.)AND7 is greater then or equal to 9 (nope).For fun and enjoyment, one evening (or week) develop a pricing engine =that takes into account multiple price levels (retail, dealer, =distributor, government, etc), customer specify prices, quantity =discounts (for all of the above), promotional pricing (with start and =end dates, also only available to some price levels) and silly price =promotion coupons (buy 2 items in a category, get the 3rd (maybe =different sku but in the same category) free). Yeah, good times... good =times. As I recall I had hair when I started that project.On Dec 13, 2012, at 5:06 PM, Terry Nair wrote:> Should it not be ....>=20> [text]howmany=3D7[/text]> [search> =table=3Dqtydiscount&leLOWdatarq=3D[howmany]&geHIGHdatarq=3D[howmany]&max=3D=1][foundi> tems][discount][/founditems][/search]>=20> The "le" and "ge" switch places so that with the value 7, it targets =the> correct row of 5,9,.02>=20> Cheers TDn>=20> -----Original Message-----> From: Brian B. Burton [mailto:brian@burtons.com]=20> Sent: Friday, December 14, 2012 01:42> To: talk@webdna.us> Subject: [BULK] Re: [WebDNA] [if] or [case] or something else> Importance: Low>=20> another way to deal with this is to use a table (or database) and =search> function.>=20> [table name=3Dqtydiscount&fields=3Dlow,high,discount] [!] tabs have =been> replaced with commas for readability, code won't work like this [/!]> 1,4,.00> 5,9,.02> 10,19,.03> 20,29,.04> 30,9999,.05> [/table]>=20> [text]howmany=3D7[/text]> [search> =table=3Dqtydiscount&geLOWdatarq=3D[howmany]&leHIGHdatarq=3D[howmany]&max=3D=1][foundi> tems][discount][/founditems][/search]>=20>=20>=20> A tip of the hat to Grant Hulbert, who taught me this method a very =very> long time ago.=20>=20> Brian B. Burton>=20> On Dec 13, 2012, at 10:13 AM, Steve Craig wrote:>=20>> Hi All>>=20>> I have a little problem that I'm hoping someone cane help with or at =least> point me in the correct direction.>>=20>> I have a list of prices, if the price lies in a particular range I do =one> set of maths, if it lies in a different range I do a different thing =etc> etc.=20>>=20>> <650 then set x to 120>> =3D>650 and < 800 set x to 110>> =3D>800 and < 950 set x to 100>> ....>> ....>> ....>>> 1550 set x to 50>>=20>> What is the best way to code it, using if then or using switch? If =it's> switch then what is the syntax of the case bit? Or maybe a different =way?>>=20>> Any help much appreciated.>>=20>=20>=20> ---------------------------------------------------------> This message is sent to you because you are subscribed to the mailing =list> .> To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us> Bug Reporting: support@webdna.us>=20> ---------------------------------------------------------> This message is sent to you because you are subscribed to> the mailing list .> To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us> Bug Reporting: support@webdna.us>=20
"Brian B. Burton"
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:
Apache suffix mapping for .tpl (2000)
FAX orders (1996)
[showif [getcookie otherDomain]=yes] inside a [TCP connect] will work? (2000)
Expert tech support -- a fast and simple solution (long) ... (2000)
OH MY GOD! (1998)
Cart doesn't interpret tag! (1997)
WebCat2: Items xx to xx shown, etc. (1997)
Cumulative Shipping charge calculations - your help please. (1997)
Newbie problem blah blah blah (1997)
WebCat2 beta 11 - new prefs ... (1997)
Review comparison by PC Magazine: Open for On-line Business (1997)
format_to_days on NT (1997)
Tab Charactor (1997)
WebDNA Threaded Discussions? (2004)
Calculating multiple shipping... (1997)
Quitting WebMerchant ? (1997)
[AppendFile] problem (WebCat2b13 Mac .acgi) (1997)
Mac Programs (1998)
Logging purchases (1997)
[isfile] ? (1997)