Re: Switch Case Context
This WebDNA talk-list message is from 2004
It keeps the original formatting.
numero = 58540
interpreted = N
texte = on 6/22/2004 2:07 pm, devaulw@onebox.com at devaulw@onebox.com so noted...> Is there anyway to get the switch/case context to work like this (pseudo-code> follows):> [switch value=X]> [CASE value>10] A [/CASE]> [CASE value>5] B [/CASE]> [CASE value=4] C [/CASE]> [CASE value=TEXT] TEXT [/CASE]> [DEFAULT] D [/DEFAULT]You could set values based on these conditions, then perform the case basedupon those. If your goal is just to set values, you don't need the [switch].[text]theValue=D[/text][text]numberX=[grep search=[^0-9\.-]&replace=][X][/grep][/text][showif [numberX]>5][text]theValue=B[/text][/showif][showif [numberX]>10][text]theValue=A[/text][/showif][showif [numberX]=4][text]theValue=C[/text][/showif][showif [X]=TEXT][text]theValue=TEXT[/text][/showif][switch value=[theValue]][case value=A] do A [/case][case value=B] do B [/case][case value=C] do C [/case][case value=TEXT] do TEXT [/case][case value=D] do D [/case][/switch]The grep is used to give more reliable results when values other than theliteral string "TEXT" are entered. There could still be unexpected resultsfor an entry of, say "cheese 4"... but then, you're the one comparing bothtext and numeric values in the same field. ; )Rob MarquardtDesigner/Resident WireheadToast Design800 Washington Avenue NorthMinneapolis MN 55401612.330.9863 v612.321.9424 fwww.toastdesign.com-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list
.To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Associated Messages, from the most recent to the oldest:
on 6/22/2004 2:07 pm, devaulw@onebox.com at devaulw@onebox.com so noted...> Is there anyway to get the switch/case context to work like this (pseudo-code> follows):> [switch value=X]> [CASE value>10] A [/CASE]> [CASE value>5] B [/CASE]> [CASE value=4] C [/CASE]> [CASE value=TEXT] TEXT [/CASE]> [DEFAULT] D [/DEFAULT]You could set values based on these conditions, then perform the case basedupon those. If your goal is just to set values, you don't need the [switch].[text]theValue=D[/text][text]numberX=[grep search=[^0-9\.-]&replace=][X][/grep][/text][showif [numberX]>5][text]theValue=B[/text][/showif][showif [numberX]>10][text]theValue=A[/text][/showif][showif [numberX]=4][text]theValue=C[/text][/showif][showif [X]=TEXT][text]theValue=TEXT[/text][/showif][switch value=[theValue]][case value=A] do A [/case][case value=B] do B [/case][case value=C] do C [/case][case value=TEXT] do TEXT [/case][case value=D] do D [/case][/switch]The grep is used to give more reliable results when values other than theliteral string "TEXT" are entered. There could still be unexpected resultsfor an entry of, say "cheese 4"... but then, you're the one comparing bothtext and numeric values in the same field. ; )Rob MarquardtDesigner/Resident WireheadToast Design800 Washington Avenue NorthMinneapolis MN 55401612.330.9863 v612.321.9424 fwww.toastdesign.com-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Rob Marquardt
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:
Upgrading old WebCat Database Files (1997)
[WebDNA] Ubuntu and WebDNA (2019)
WebCat Admin access w/ClearlyHome p.i. (1997)
My slower response (1997)
[WebDNA] Apple nixes Mac OS Server ("websites") and other (2018)
Add a field to the error log? (1997)
[AppendFile] problem (WebCat2b13 Mac .acgi) (1997)
WebCat2: Items xx to xx shown, etc. (1997)
text area input and convertchars (2002)
F3 crashing server (1997)
Email Set-Up? (1997)
WebCat2b13MacPlugIn - [include] doesn't allow creator (1997)
WebCat2: multiple currency support (1997)
Re:PCS Customer submissions ? (1997)
WebCatalog2 Feature Feedback (1996)
WebCatalog Features (1997)
PCS Frames (1997)
About the E-mailer (2002)
Where is f2? (1997)
Secure server question (1997)