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.) AND 7 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.) AND 7 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:

Sorting... stumped. (2006) Possible Bug in 2.0b15.acgi (1997) Alternating colors (1997) Extended [ConvertChars] (1997) Frames and cart values (1998) FW: ANother SHOWIF problem (1997) WebTV (1998) Limit to Field Length in DB (1998) Monthly Reports (2000) How To question on setting up downloads (1997) RequiredFields template (1997) Trouble with formula.db (1997) [WebDNA] Archives (2009) Help! WebCat2 bug (Ben's input) (1997) Sorting problem (2002) Just Testing (1997) WebCat2 - [format thousands] (1997) Re: (1998) users.db (1999) Bad creator codes which cause access denied errormessage (1997)