Re: [WebDNA] [if] or [case] or something else
This WebDNA talk-list message is from 2012
It keeps the original formatting.
numero = 110020
interpreted = N
texte = Switch only works for "equals" comparisons, not less than or greater =than, so if/then/else is your best choice here.[text]x=3D[if [price]<650][then]120[/then][else][if =[price]<800][then]110[/then][else]100[/else][/if][/else][/if][/text]You can extend this as far as you like; just be sure to close all the =if, then and else contexts properly.BrianOn Dec 13, 2012, at 8:13 AM, Steve Craig
wrote:> 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> Cheers> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D> Steve Craig - Asylum Interactive Ltd> Tel +44 1330 860550 Fax +44 1330 860880> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D> http://www.asylumweb.com> Email: steve@asylumweb.com> Skype: s.craig - iChat: steve.craig> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D>=20>=20>=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
Associated Messages, from the most recent to the oldest:
Switch only works for "equals" comparisons, not less than or greater =than, so if/then/else is your best choice here.[text]x=3D[if [price]<650][then]120[/then][else][if =[price]<800][then]110[/then][else]100[/else][/if][/else][/if][/text]You can extend this as far as you like; just be sure to close all the =if, then and else contexts properly.BrianOn Dec 13, 2012, at 8:13 AM, Steve Craig wrote:> 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> Cheers> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D> Steve Craig - Asylum Interactive Ltd> Tel +44 1330 860550 Fax +44 1330 860880> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D> http://www.asylumweb.com> Email: steve@asylumweb.com> Skype: s.craig - iChat: steve.craig> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D==3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D>=20>=20>=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
Brian Fries
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:
PCS Customer submissions ? (1997)
Help getting [shownext] to increment (2003)
[sendmail] ampersand issue (2001)
Hairy Shipping Monster (2006)
Where is the bug fix info for 4.0.1? (2000)
Kill the webcat process (2000)
WebCat B13 Mac CGI -- Frames question (1997)
Sorting problems (2000)
WebCat2b15MacPlugin - [protect] (1997)
WC2b15 File Corruption (1997)
WebCat2.0 [format thousands .0f] no go (1997)
[ModDate] & [ModTime] ? (1997)
OT: Canadian Zip Codes (2000)
writing checkboxes to a database (2000)
WebCatalog2 Feature Feedback (1996)
New Site Announcement (1998)
TCPConnect / Current Temperature (2004)
Can't find templaes (1997)
Extended [ConvertChars] (1997)
Requird Fields Error Message (2000)