RE: [BULK] Re: [WebDNA] [if] or [case] or something else

This WebDNA talk-list message is from

2012


It keeps the original formatting.
numero = 110032
interpreted = N
texte = Hi Brian .... Strange ....I tried the code your way ....Did not work. Tried mine ...worked. According to the docs and replacing the field name where appropriate (paraphrasing so to speak) .... less than or equal to - leLOWdatarq=7 finds all records whose LOW field is "less than or equal to" 7. That means the range 1 to 4 and 5 to 9 qualify. greater than or equal to - geHIGHdatarq=7 finds all records whose HIGH field is "greater than or equal to" 7. That means all the table rows qualify except for range 1 to 4. Given we have a "rq" which means AND both conditions must be met ....the only table row is one which is the range 5 to 9. Basically, you refer to the [howmany] as greater then or equal to when it should be read as LOW values that are greater then or equal to. Interpretation error. Anyway, try it on your test / dev server ......don't want anyone losing hair on this ....barely keeping mine on these days ..LOL Cheers TDn -----Original Message----- From: Brian B. Burton [mailto:brian@burtons.com] Sent: Friday, December 14, 2012 11:02 To: talk@webdna.us Subject: Re: [BULK] Re: [WebDNA] [if] or [case] or something else Importance: Low 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 .... > > [text]howmany=7[/text] > [search > table=qtydiscount&leLOWdatarq=[howmany]&geHIGHdatarq=[howmany]&max=1][ > foundi > tems][discount][/founditems][/search] > > The "le" and "ge" switch places so that with the value 7, it targets > the correct row of 5,9,.02 > > Cheers TDn > > -----Original Message----- > From: Brian B. Burton [mailto:brian@burtons.com] > Sent: Friday, December 14, 2012 01:42 > To: talk@webdna.us > Subject: [BULK] Re: [WebDNA] [if] or [case] or something else > Importance: Low > > another way to deal with this is to use a table (or database) and > search function. > > [table name=qtydiscount&fields=low,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] > > [text]howmany=7[/text] > [search > table=qtydiscount&geLOWdatarq=[howmany]&leHIGHdatarq=[howmany]&max=1][ > foundi > tems][discount][/founditems][/search] > > > > A tip of the hat to Grant Hulbert, who taught me this method a very > very long time ago. > > Brian B. Burton > > On Dec 13, 2012, at 10:13 AM, Steve Craig wrote: > >> Hi All >> >> I have a little problem that I'm hoping someone cane help with or at >> least > point me in the correct direction. >> >> 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. >> >> <650 then set x to 120 >> =>650 and < 800 set x to 110 >> =>800 and < 950 set x to 100 >> .... >> .... >> .... >>> 1550 set x to 50 >> >> 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? >> >> Any help much appreciated. >> > > > --------------------------------------------------------- > 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 > > --------------------------------------------------------- > 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 > --------------------------------------------------------- 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 Associated Messages, from the most recent to the oldest:

    
Hi Brian .... Strange ....I tried the code your way ....Did not work. Tried mine ...worked. According to the docs and replacing the field name where appropriate (paraphrasing so to speak) .... less than or equal to - leLOWdatarq=7 finds all records whose LOW field is "less than or equal to" 7. That means the range 1 to 4 and 5 to 9 qualify. greater than or equal to - geHIGHdatarq=7 finds all records whose HIGH field is "greater than or equal to" 7. That means all the table rows qualify except for range 1 to 4. Given we have a "rq" which means AND both conditions must be met ....the only table row is one which is the range 5 to 9. Basically, you refer to the [howmany] as greater then or equal to when it should be read as LOW values that are greater then or equal to. Interpretation error. Anyway, try it on your test / dev server ......don't want anyone losing hair on this ....barely keeping mine on these days ..LOL Cheers TDn -----Original Message----- From: Brian B. Burton [mailto:brian@burtons.com] Sent: Friday, December 14, 2012 11:02 To: talk@webdna.us Subject: Re: [BULK] Re: [WebDNA] [if] or [case] or something else Importance: Low 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 .... > > [text]howmany=7[/text] > [search > table=qtydiscount&leLOWdatarq=[howmany]&geHIGHdatarq=[howmany]&max=1][ > foundi > tems][discount][/founditems][/search] > > The "le" and "ge" switch places so that with the value 7, it targets > the correct row of 5,9,.02 > > Cheers TDn > > -----Original Message----- > From: Brian B. Burton [mailto:brian@burtons.com] > Sent: Friday, December 14, 2012 01:42 > To: talk@webdna.us > Subject: [BULK] Re: [WebDNA] [if] or [case] or something else > Importance: Low > > another way to deal with this is to use a table (or database) and > search function. > > [table name=qtydiscount&fields=low,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] > > [text]howmany=7[/text] > [search > table=qtydiscount&geLOWdatarq=[howmany]&leHIGHdatarq=[howmany]&max=1][ > foundi > tems][discount][/founditems][/search] > > > > A tip of the hat to Grant Hulbert, who taught me this method a very > very long time ago. > > Brian B. Burton > > On Dec 13, 2012, at 10:13 AM, Steve Craig wrote: > >> Hi All >> >> I have a little problem that I'm hoping someone cane help with or at >> least > point me in the correct direction. >> >> 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. >> >> <650 then set x to 120 >> =>650 and < 800 set x to 110 >> =>800 and < 950 set x to 100 >> .... >> .... >> .... >>> 1550 set x to 50 >> >> 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? >> >> Any help much appreciated. >> > > > --------------------------------------------------------- > 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 > > --------------------------------------------------------- > 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 > --------------------------------------------------------- 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 "Terry Nair"

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:

[search][founditems][orderfile] (2003) taxTotal, grandTotal (1997) Credit Card Verification.... (1998) How do you TEAM Code? (2004) Re:multiple digests, please stop (1997) Notepad problems - SOLVED! (1998) Sandbox DB permissions (2005) [WebDNA] how can I get error logs (2018) [WebDNA] Problem with Cookies in IE and Safari (2009) apparently to problem isolated (1997) UPDATE PROBLEM (1997) Help formatting search results w/ table (1997) WC 3.0.1 Mac days_to_date (1998) Another question (1997) [WebDNA] WebDNA 8.6.4 (2020) shownext (1997) Forbidden CGI Error (1997) Cart# (1997) shipcost (1997) [QuantityPrice] Not working in WebCatNT 2.0.1??? (1997)