Re: [WebDNA] feature suggestion

This WebDNA talk-list message is from

2011


It keeps the original formatting.
numero = 106782
interpreted = N
texte = [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, = rewriting my code now :)=20 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. >=20 > Additionally it sets the global variable "definedValue" to the value = of 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 to do your own [interpret] after the fact) >=20 >=20 > [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] >=20 >=20 > Example: >=20 > [if [isDefined myVariable]][then] > myVariable is set to [definedValue] > [/then][else] > myVariable is not defined > [/else][/if] >=20 >=20 > Brian Fries > BrainScan Software >=20 >=20 >=20 > On Jun 22, 2011, at 10:10 AM, Brian B. Burton wrote: >=20 >> 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.=20 >>=20 >>=20 >> On Jun 22, 2011, at 1:02 PM, Govinda wrote: >>=20 >>> :-) >>>=20 >>> I would like that too.. but have it apply to any [var] and not only = a db [field]. >>>=20 >>>=20 >>>> Need a new tag that is a showif if a field exists and is not empty >>>>=20 >>>> i.e. >>>> [hideif [url][content_title][/url]=3D%5Bcontent_title%5D][hideif = [url][content_title][/url]=3D]

[content_title]


[/hideif][/h= ideif] >>>>=20 >>>> too much typing.=20 >>>>=20 >>>> suggestion: >>>> [? [fieldname]] blah blah [/?] >>>> (yeah, I mean literal question marks) >>>>=20 >>>>=20 >>>> Thanks :)=20 >>>>=20 >>>> Brian B. Associated Messages, from the most recent to the oldest:

    
[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, = rewriting my code now :)=20 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. >=20 > Additionally it sets the global variable "definedValue" to the value = of 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 to do your own [interpret] after the fact) >=20 >=20 > [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] >=20 >=20 > Example: >=20 > [if [isDefined myVariable]][then] > myVariable is set to [definedValue] > [/then][else] > myVariable is not defined > [/else][/if] >=20 >=20 > Brian Fries > BrainScan Software >=20 >=20 >=20 > On Jun 22, 2011, at 10:10 AM, Brian B. Burton wrote: >=20 >> 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.=20 >>=20 >>=20 >> On Jun 22, 2011, at 1:02 PM, Govinda wrote: >>=20 >>> :-) >>>=20 >>> I would like that too.. but have it apply to any [var] and not only = a db [field]. >>>=20 >>>=20 >>>> Need a new tag that is a showif if a field exists and is not empty >>>>=20 >>>> i.e. >>>> [hideif [url][content_title][/url]=3D%5Bcontent_title%5D][hideif = [url][content_title][/url]=3D]

[content_title]


[/hideif][/h= ideif] >>>>=20 >>>> too much typing.=20 >>>>=20 >>>> suggestion: >>>> [? [fieldname]] blah blah [/?] >>>> (yeah, I mean literal question marks) >>>>=20 >>>>=20 >>>> Thanks :)=20 >>>>=20 >>>> Brian B. "Brian B. Burton"

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:

AddLineitems - 100 Item Limit? (2002) Rams SuperBowl Champs (2000) Pithy questions on webcommerce & siteedit (1997) Server problem? (1998) mime types (2003) RE: E-mailer error codes (1997) Include files (1998) WebCat2b12 - nesting [tags] (1997) Re:Help name our technology! (1997) verify online (1997) PIXO with cometsite ... and/or other plugins (1998) transferring values (1998) WebCat B13 Mac CGI -- Frames question (1997) WebCatalog Features (1997) ODBC-Interface (2000) Multiple prices (1997) Site Check (2006) many-to-one problem (1998) Image upload (2000) can WC render sites out? (1997)