Re: [WebDNA] feature suggestion

This WebDNA talk-list message is from

2011


It keeps the original formatting.
numero = 106784
interpreted = N
texte = Years back, someone taught me to do this to find if a variable is=20 undefined... if [myvar]=3D[raw][myvar][/raw] then.... or if [interpret][[myvar]][/interpret]=3D[[myvar]] then.... has always worked perfectly, and I really like the semantics of using=20 the [raw] tag A new feature added to the [if] tag would be great. maybe behave=20 similar to using boolean logic shorthand in javascript if() statements for example... if ( x ) { do something if x exists } or if ( !x ) { do something if x doesn't exist } in webDNA could be.. [if ([myVar])][then].... or [if (![myVar])][then].... On 6/22/11 2:01 PM, Brian B. Burton wrote: > [function name=3D?] > [If ("[url][interpret][[f]][/interpret][/url]"!"%5B[interpret][f][= /interpret]%5D")& ("[url][interpret][[f]][/interpret][/url]"!"")] > [Then][return]T[/return][/Then] > [Else][return]F[/return][/Else] > [/If] > [/function] > > > USAGE: > > [text]abc=3D123[/text] > [!]def is undefined[/!] > [text]ghi=3D[/text] > > >

> > abc =3D [abc]
[? f=3Dabc] > >

> > def =3D [def]
[? f=3Ddef] > >

> > ghi =3D [ghi]
[? f=3Dghi] > >

> > [showif [? f=3Dabc]=3DT]whatever you want to show or execute[/showif] > > [showif [? f=3Ddef]=3DT]nothing will show or execute[/showif] > > > Brian: I like your use of params_string, cuts out two more letters, rew= riting my code now :) > > On Jun 22, 2011, at 1:31 PM, Brian Fries wrote: > >> Here's my function for this=85. I return "1=3D0" for false or "1=3D1" = for true, which makes it simple to use in an IF or a SHOWIF=85 feel free = to change that if you prefer the T or F returned. >> >> Additionally it sets the global variable "definedValue" to the value o= f that variable/field/whatever it is, which is convenient when the target= field name comes from a variable, listwords, etc. (i.e. you don't need t= o do your own [interpret] after the fact) >> >> >> [function name=3DisDefined] >> [text]tValue=3D[interpret][[params_string]][/interpret][/text] >> [if "[url][tValue][/url]"=3D"%5B[params_string]%5D][then] >> [text scope=3Dglobal]definedValue=3D[/text] >> [return]1=3D0[/return] >> [/then][else] >> [text scope=3Dglobal]definedValue=3D[tValue][/text] >> [return]1=3D1[/return] >> [/else][/if] >> [/function] >> >> >> Example: >> >> [if [isDefined myVariable]][then] >> myVariable is set to [definedValue] >> [/then][else] >> myVariable is not defined >> [/else][/if] >> >> >> Brian Fries >> BrainScan Software >> >> >> >> On Jun 22, 2011, at 10:10 AM, Brian B. Burton wrote: >> >>> i'm writing it up as a function that returns T/F. I'll post the code = to the talk list as soon as I'm happy with it. >>> >>> >>> On Jun 22, 2011, at 1:02 PM, Govinda wrote: >>> >>>> :-) >>>> >>>> I would like that too.. but have it apply to any [var] and not only= a db [field]. >>>> >>>> >>>>> Need a new tag that is a showif if a field exists and is not empty >>>>> >>>>> i.e. >>>>> [hideif [url][content_title][/url]=3D%5Bcontent_title%5D][hideif [u= rl][content_title][/url]=3D]

[content_title]


[/hideif][/hi= deif] >>>>> >>>>> too much typing. >>>>> >>>>> suggestion: >>>>> [? [fieldname]] blah blah [/?] >>>>> (yeah, I mean literal question marks) >>>>> >>>>> >>>>> Thanks :) >>>>> >>>>> Brian B. > > --------------------------------------------------------- > 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:

    
  1. Re: [WebDNA] feature suggestion (Olin Lagon 2011)
  2. Re: [WebDNA] feature suggestion (William DeVaul 2011)
  3. Re: [WebDNA] feature suggestion ("Brian B. Burton" 2011)
  4. Re: [WebDNA] feature suggestion (William DeVaul 2011)
  5. Re: [WebDNA] feature suggestion - long response (Govinda 2011)
  6. Re: [WebDNA] feature suggestion (Govinda 2011)
  7. Re: [WebDNA] feature suggestion - long response (William DeVaul 2011)
  8. Re: [WebDNA] feature suggestion (William DeVaul 2011)
  9. Re: [WebDNA] feature suggestion - long response (Tom Duke 2011)
  10. Re: [WebDNA] feature suggestion - long response (Ronald Kirkland 2011)
  11. Re: [WebDNA] feature suggestion - long response (Ronald Kirkland 2011)
  12. Re: [WebDNA] feature suggestion - long response ("Brian B. Burton" 2011)
  13. Re: [WebDNA] feature suggestion - long response (Kenneth Grome 2011)
  14. Re: [WebDNA] feature suggestion - long response ("Brian B. Burton" 2011)
  15. Re: [WebDNA] feature suggestion (Kenneth Grome 2011)
  16. Re: [WebDNA] feature suggestion (William DeVaul 2011)
  17. Re: [WebDNA] feature suggestion (William DeVaul 2011)
  18. Re: [WebDNA] feature suggestion (Aaron Michael Kaczmarek 2011)
  19. Re: [WebDNA] feature suggestion ("Brian B. Burton" 2011)
  20. Re: [WebDNA] feature suggestion (Brian Fries 2011)
  21. Re: [WebDNA] feature suggestion ("Brian B. Burton" 2011)
  22. Re: [WebDNA] feature suggestion (Govinda 2011)
  23. [WebDNA] feature suggestion ("Brian B. Burton" 2011)
Years back, someone taught me to do this to find if a variable is=20 undefined... if [myvar]=3D[raw][myvar][/raw] then.... or if [interpret][[myvar]][/interpret]=3D[[myvar]] then.... has always worked perfectly, and I really like the semantics of using=20 the [raw] tag A new feature added to the [if] tag would be great. maybe behave=20 similar to using boolean logic shorthand in javascript if() statements for example... if ( x ) { do something if x exists } or if ( !x ) { do something if x doesn't exist } in webDNA could be.. [if ([myVar])][then].... or [if (![myVar])][then].... On 6/22/11 2:01 PM, Brian B. Burton wrote: > [function name=3D?] > [If ("[url][interpret][[f]][/interpret][/url]"!"%5B[interpret][f][= /interpret]%5D")& ("[url][interpret][[f]][/interpret][/url]"!"")] > [Then][return]T[/return][/Then] > [Else][return]F[/return][/Else] > [/If] > [/function] > > > USAGE: > > [text]abc=3D123[/text] > [!]def is undefined[/!] > [text]ghi=3D[/text] > > >

> > abc =3D [abc]
[? f=3Dabc] > >

> > def =3D [def]
[? f=3Ddef] > >

> > ghi =3D [ghi]
[? f=3Dghi] > >

> > [showif [? f=3Dabc]=3DT]whatever you want to show or execute[/showif] > > [showif [? f=3Ddef]=3DT]nothing will show or execute[/showif] > > > Brian: I like your use of params_string, cuts out two more letters, rew= riting my code now :) > > On Jun 22, 2011, at 1:31 PM, Brian Fries wrote: > >> Here's my function for this=85. I return "1=3D0" for false or "1=3D1" = for true, which makes it simple to use in an IF or a SHOWIF=85 feel free = to change that if you prefer the T or F returned. >> >> Additionally it sets the global variable "definedValue" to the value o= f that variable/field/whatever it is, which is convenient when the target= field name comes from a variable, listwords, etc. (i.e. you don't need t= o do your own [interpret] after the fact) >> >> >> [function name=3DisDefined] >> [text]tValue=3D[interpret][[params_string]][/interpret][/text] >> [if "[url][tValue][/url]"=3D"%5B[params_string]%5D][then] >> [text scope=3Dglobal]definedValue=3D[/text] >> [return]1=3D0[/return] >> [/then][else] >> [text scope=3Dglobal]definedValue=3D[tValue][/text] >> [return]1=3D1[/return] >> [/else][/if] >> [/function] >> >> >> Example: >> >> [if [isDefined myVariable]][then] >> myVariable is set to [definedValue] >> [/then][else] >> myVariable is not defined >> [/else][/if] >> >> >> Brian Fries >> BrainScan Software >> >> >> >> On Jun 22, 2011, at 10:10 AM, Brian B. Burton wrote: >> >>> i'm writing it up as a function that returns T/F. I'll post the code = to the Talk List as soon as I'm happy with it. >>> >>> >>> On Jun 22, 2011, at 1:02 PM, Govinda wrote: >>> >>>> :-) >>>> >>>> I would like that too.. but have it apply to any [var] and not only= a db [field]. >>>> >>>> >>>>> Need a new tag that is a showif if a field exists and is not empty >>>>> >>>>> i.e. >>>>> [hideif [url][content_title][/url]=3D%5Bcontent_title%5D][hideif [u= rl][content_title][/url]=3D]

[content_title]


[/hideif][/hi= deif] >>>>> >>>>> too much typing. >>>>> >>>>> suggestion: >>>>> [? [fieldname]] blah blah [/?] >>>>> (yeah, I mean literal question marks) >>>>> >>>>> >>>>> Thanks :) >>>>> >>>>> Brian B. > > --------------------------------------------------------- > 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 Aaron Michael Kaczmarek

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:

[ShowNext] (1997) HTML Editors (1997) Forcing a NEWCART (1997) Multiple prices per product (2004) Getting total number of items ordered (1997) WebCat2b15MacPlugin - showing [math] (1997) mail header timezone problem (2007) FTP (1999) Execute Applescript (1997) TinyStore Question (1999) Moving files from one server to another... (2001) price on detail, but not shoppingcart (1997) Document Contains No Data! (1997) RE: redirect with more than 256 characters (1999) Cookie Newbie (2002) Drop Down Menus (2002) How much is too much? I can never remember the answer. (2002) Date Calulation (1997) international time (1997) frames & carts (1997)