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 :)=20On 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 :)=20On 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:
[format xs] freeze (1997)
[WebDNA] [data] and RETS (2009)
shoppingcart reload qty (1997)
Mass-mailer options - any suggestions ? (2005)
WebCatalog for guestbook ? (1997)
Include vs. lookup? (1998)
My slower response (1997)
WebCat editing, SiteGuard WAS:SiteAssociative lookup style? (1997)
Not reading code (1997)
[WebDNA] Setting Content-Type within [returnraw] - not working (2010)
Separate SSL Server (1997)
TEXT A-E (2000)
Overseas project (2000)
Banners (1997)
[WriteFile] problems (1997)
return missing item (was:WebCat Sales) (1997)
Word search (1997)
Add Unit Ship Cost to Cart (2000)
Restart of DBserver (1997)
2nd WebCatalog2 Feature Request (1996)