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:
WebDNA Programmer looking for a new job - again! (2002)
Looking up two prices in database? (1997)
Interface to Quickbooks (2005)
apostrophe in search item (1997)
List Address Changed! (1998)
referrer and no caches (1997)
Almost a there but..bye bye NetCloak (1997)
Reversed words (1997)
Problem with version 4 browsers (1998)
Quantity * price (1997)
Multi-Row Tables from a search. (1997)
default error on NT? (1997)
New Plug-in and Type 11 errors (1997)
Weird Cookie Problem - your answer (2007)
[searchString] (1997)
Checkboxes to add to cart... (1998)
New public beta available (1997)
international time (1997)
forms and variables (1998)
Single Link browsing (1997)