Re: Undeclared variables
This WebDNA talk-list message is from 2004
It keeps the original formatting.
numero = 57538
interpreted = N
texte = Here's a simple function to return T if a text variable is defined, or F if it is not. It could easily be adapted for math or form variables as well...[function name=isTextVariable][text]tReturn=F[/text][listvariables type=text&name=[params_string]][text]tReturn=T[/text][/listvariables][return][tReturn][/return][/function]Example of use:[text]bob=1[/text][if "T"="[isTextVariable bob]"][then]yes on bob[/then][else]no on bob[/else][/if]
[if "T"="[isTextVariable bill]"][then]yes on bill[/then][else]no on bill[/else][/if]
returns:yes on bobno on bill- brianOn Apr 23, 2004, at 12:55 PM, devaulw@onebox.com wrote:> [showif [defined][var][/defined]=T]>> [showif [def][var][/def]=T]>> or> [showif [defined var=var1&var2&var2]=T]>> for a list of variables.>> Is this something that would work well as a function?>>> -----Original Message-----> From: charles kline
> Sent: Fri, 23 Apr 2004 14:08:50 -0400> To: (WebDNA Talk)> Subject: Re: Undeclared variables>> Would be cool to have...>> [showif [isset var=somevar]=T][/showif]>> On Apr 23, 2004, at 1:29 PM, Terry Wilson wrote:>>> Is there a more elegant way to do this:>>>> [showif [variable]=[raw][variable][/raw]]variable=some default >> value[/showif]>>>> Seems like using [raw] is a pretty kludgey way of determining if a >> variable is undefined. I've been doing this forever, and maybe in ver >> 6 there's a better way now?>-- Brian Fries, BrainScan Software -- http://www.brainscansoftware.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:
Here's a simple function to return T if a text variable is defined, or F if it is not. It could easily be adapted for math or form variables as well...[function name=isTextVariable][text]tReturn=F[/text][listvariables type=text&name=[params_string]][text]tReturn=T[/text][/listvariables][return][tReturn][/return][/function]Example of use:[text]bob=1[/text][if "T"="[isTextVariable bob]"][then]yes on bob[/then][else]no on bob[/else][/if]
[if "T"="[isTextVariable bill]"][then]yes on bill[/then][else]no on bill[/else][/if]
returns:yes on bobno on bill- brianOn Apr 23, 2004, at 12:55 PM, devaulw@onebox.com wrote:> [showif [defined][var][/defined]=T]>> [showif [def][var][/def]=T]>> or> [showif [defined var=var1&var2&var2]=T]>> for a list of variables.>> Is this something that would work well as a function?>>> -----Original Message-----> From: charles kline > Sent: Fri, 23 Apr 2004 14:08:50 -0400> To: (WebDNA Talk)> Subject: Re: Undeclared variables>> Would be cool to have...>> [showif [isset var=somevar]=T][/showif]>> On Apr 23, 2004, at 1:29 PM, Terry Wilson wrote:>>> Is there a more elegant way to do this:>>>> [showif [variable]=[raw][variable][/raw]]variable=some default >> value[/showif]>>>> Seems like using [raw] is a pretty kludgey way of determining if a >> variable is undefined. I've been doing this forever, and maybe in ver >> 6 there's a better way now?>-- Brian Fries, BrainScan Software -- http://www.brainscansoftware.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/
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:
Link with [cart] in db field (1999)
looking for some paid WebCatalog help (2000)
send mail problem? (1997)
WC2b12: Yes, Formulas.db is for real (1997)
Database Term [brainfart] (2003)
Variable Math (1998)
Webcat and other cgi (2000)
Shopping carts and reloading pages (1997)
emailer on Windows Beta 18 (1997)
[WebDNA] showif with empty variable (2015)
Shipping [grandtotal] solution (1997)
Document Contains No Data (1998)
[WebDNA] RSS Feed (2008)
Expires header (1999)
WebDNA tables and commas (2004)
WebCat2 several catalogs? (1997)
RSS Feeds; basic info (2005)
Help formatting search results w/ table (1997)
Bug Report, maybe (1997)
There's a bug in the math context ... (1997)