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:
The evolved Server Configuration Queston (2000)
Too Much Info (1998)
Apache 2.0 question (AddModule mod_webcatalog.cpp) (2008)
Spawn doesn't work as advertised ... (2000)
Access Denied! But why? (1997)
Running 2 two WebCatalog.acgi's (1996)
OSX Webcatalog Install (2001)
LetterRip and WebCat (1998)
RE: path hierarchy notation (1998)
Still can't upgrade users.db to 2.1.1 (1998)
ANN: Strategic Partnership with BuyStream Announced. (2000)
Getting Emailer to send mail (1997)
[WebDNA] ONLY the FIRST continuous run of numeric chars? (2008)
Compressed cookies - follow-up (2003)
NT vs Mac (1997)
Upgrade Pricing? (2003)
Help SM: Duplicate cart #'s - still! (2003)
RE: Database Structure? (1998)
Webcat 3.0.5b9, b8 trigger failures ON WEBSTAR (1999)
WebCat.acgi from /cgi-bin/? (1997)