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 bob no on bill - brian On 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:

    
  1. Re: Undeclared variables ( Brian Fries 2004)
  2. Re: Undeclared variables ( Rob Marquardt 2004)
  3. Re: Undeclared variables ( Alan White 2004)
  4. Re: Undeclared variables ( charles kline 2004)
  5. Re: Undeclared variables ( Alan White 2004)
  6. Re: Undeclared variables ( Terry Wilson 2004)
  7. Re: Undeclared variables ( "WebDna @ Inkblot Media" 2004)
  8. Re: Undeclared variables ( Kenneth Grome 2004)
  9. Re: Undeclared variables ( charles kline 2004)
  10. Re: Undeclared variables ( Kenneth Grome 2004)
  11. Re: Undeclared variables ( charles kline 2004)
  12. Re: Undeclared variables ( Kenneth Grome 2004)
  13. Re: Undeclared variables ( devaulw@onebox.com 2004)
  14. Re: Undeclared variables ( charles kline 2004)
  15. Re: Undeclared variables ( Rob Marquardt 2004)
  16. Undeclared variables ( Terry Wilson 2004)
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 bob no on bill - brian On 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:

WebCat2.0b15-to many nested [xx] tags (1997) A quickie question (1997) syntax question, not in online refernce (1997) WebCat2b13MacPlugIn - [showif][search][/showif] (1997) RE: question on [delete] (1998) Bug Report, maybe (1997) placement of ? (2000) Single Link browsing (1997) Possible Bug in 2.0b15.acgi (1997) Re(7): Small Bug: ErrorLog.txt/[FORMVARIABLES]/[ORDERFILE] (1998) WebCat2 - [format thousands] (1997) Likelihood of a duplicate (Palle you around?) (2005) bug in listwords? (1998) Problems searching from a FORM (1997) Limiting user access to .tmpl files (1997) Rumpus/Typhoon modules included in Typhoon ... (1997) Site Builder & IE Mac (2004) Running _every_ page through WebCat-error.html (1997) Ports? (2002) Banners (1997)