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:
off topic - dna snipets (1997)
HTML Editors (1997)
[ShowIf] and empty fields (1997)
[WebDNA] Local Development On Windows 8.1 (2015)
WebCat editing, SiteGuard & SiteEdit (1997)
Help! WebCat2 bug (1997)
WebCat2b15MacPlugIn - [authenticate] not [protect] (1997)
Hiding HTML and breaking the page (1997)
Internet Explorer and caching (2000)
Summing fields (1997)
Generating Report Totals (1997)
exclusive db lock with webcat-3 ? (2000)
Virtual Postcards (1998)
WebDelivery: One step closer !! (1997)
WSDL Web services design wizard (2005)
pop up menu's (1998)
Bad creator codes which cause access denied error message (1997)
Re:Problem displaying search result (1997)
Formulas.db + Users.db (1997)
(1997)