Re: [WebDNA] feature suggestion
This WebDNA talk-list message is from 2011
It keeps the original formatting.
numero = 106789
interpreted = N
texte = Missing a closing bracket on the showif below.BillOn Wed, Jun 22, 2011 at 4:58 PM, William DeVaul
wrote:> [!]EXAMPLE USAGE:[var_exists? name=3Dv_id][/!]> [function name=3Dvar_exists?][:global:[name]]![interpret][[name]][/interp=ret][/function]> [!]EXAMPLE USAGE:[var_not_exist? name=3Dv_id][/!]> [function name=3Dvar_not_exist?][:global:[name]]=3D[interpret][[name]][/i=nterpret][/function]>> These return the condition you want in the showif, e.g.:>> [showif [var_exists? name=3Dcritical_var]]> =A0critical stuff> [/showif]>> I like the use of ? that I saw in another post. =A0Can we use ! for the> false result?>> Note that this does not use the brackets around the name of the> variable. =A0Enough with the brackets already!>> Bill>> On Wed, Jun 22, 2011 at 2:38 PM, Aaron Michael Kaczmarek> wrote:>> Years back, someone taught me to do this to find if a variable is>> undefined...>>>> if [myvar]=3D[raw][myvar][/raw] then....>> =A0or>> if [interpret][[myvar]][/interpret]=3D[[myvar]] then....>>>> has always worked perfectly, and I really like the semantics of using th=e>> [raw] tag>>>>>> A new feature added to the [if] tag would be great. =A0maybe behave simi=lar 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?]>>> =A0 =A0 [If>>> ("[url][interpret][[f]][/interpret][/url]"!"%5B[interpret][f][/interpre=t]%5D")&>>> =A0("[url][interpret][[f]][/interpret][/url]"!"")]>>> =A0 =A0 =A0 =A0 [Then][return]T[/return][/Then]>>> =A0 =A0 =A0 =A0 [Else][return]F[/return][/Else]>>> =A0 =A0 [/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 :)>>>>>> 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 chan=ge 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 targe=t>>>> field name comes from a variable, listwords, etc. (i.e. you don't need= to do>>>> your own [interpret] after the fact)>>>>>>>>>>>> [function name=3DisDefined]>>>> =A0 =A0 =A0 =A0[text]tValue=3D[interpret][[params_string]][/interpret]=[/text]>>>> =A0 =A0 =A0 =A0[if "[url][tValue][/url]"=3D"%5B[params_string]%5D][the=n]>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[text scope=3Dglobal]definedValue=3D[/t=ext]>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[return]1=3D0[/return]>>>> =A0 =A0 =A0 =A0[/then][else]>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[text scope=3Dglobal]definedValue=3D[tV=alue][/text]>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[return]1=3D1[/return]>>>> =A0 =A0 =A0 =A0[/else][/if]>>>> [/function]>>>>>>>>>>>> Example:>>>>>>>> [if [isDefined myVariable]][then]>>>> =A0 =A0 =A0 =A0myVariable is set to [definedValue]>>>> [/then][else]>>>> =A0 =A0 =A0 =A0myVariable 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.. =A0but have it apply to any [var] and not on=ly 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>>>>>>> [url][content_title][/url]=3D]
[content_title]
[/hid=eif][/hideif]>>>>>>>>>>>>>> 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>>>> --------------------------------------------------------->> 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:
Missing a closing bracket on the showif below.BillOn Wed, Jun 22, 2011 at 4:58 PM, William DeVaul wrote:> [!]EXAMPLE USAGE:[var_exists? name=3Dv_id][/!]> [function name=3Dvar_exists?][:global:[name]]![interpret][[name]][/interp=ret][/function]> [!]EXAMPLE USAGE:[var_not_exist? name=3Dv_id][/!]> [function name=3Dvar_not_exist?][:global:[name]]=3D[interpret][[name]][/i=nterpret][/function]>> These return the condition you want in the showif, e.g.:>> [showif [var_exists? name=3Dcritical_var]]> =A0critical stuff> [/showif]>> I like the use of ? that I saw in another post. =A0Can we use ! for the> false result?>> Note that this does not use the brackets around the name of the> variable. =A0Enough with the brackets already!>> Bill>> On Wed, Jun 22, 2011 at 2:38 PM, Aaron Michael Kaczmarek> wrote:>> Years back, someone taught me to do this to find if a variable is>> undefined...>>>> if [myvar]=3D[raw][myvar][/raw] then....>> =A0or>> if [interpret][[myvar]][/interpret]=3D[[myvar]] then....>>>> has always worked perfectly, and I really like the semantics of using th=e>> [raw] tag>>>>>> A new feature added to the [if] tag would be great. =A0maybe behave simi=lar 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?]>>> =A0 =A0 [If>>> ("[url][interpret][[f]][/interpret][/url]"!"%5B[interpret][f][/interpre=t]%5D")&>>> =A0("[url][interpret][[f]][/interpret][/url]"!"")]>>> =A0 =A0 =A0 =A0 [Then][return]T[/return][/Then]>>> =A0 =A0 =A0 =A0 [Else][return]F[/return][/Else]>>> =A0 =A0 [/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 :)>>>>>> 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 chan=ge 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 targe=t>>>> field name comes from a variable, listwords, etc. (i.e. you don't need= to do>>>> your own [interpret] after the fact)>>>>>>>>>>>> [function name=3DisDefined]>>>> =A0 =A0 =A0 =A0[text]tValue=3D[interpret][[params_string]][/interpret]=[/text]>>>> =A0 =A0 =A0 =A0[if "[url][tValue][/url]"=3D"%5B[params_string]%5D][the=n]>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[text scope=3Dglobal]definedValue=3D[/t=ext]>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[return]1=3D0[/return]>>>> =A0 =A0 =A0 =A0[/then][else]>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[text scope=3Dglobal]definedValue=3D[tV=alue][/text]>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[return]1=3D1[/return]>>>> =A0 =A0 =A0 =A0[/else][/if]>>>> [/function]>>>>>>>>>>>> Example:>>>>>>>> [if [isDefined myVariable]][then]>>>> =A0 =A0 =A0 =A0myVariable is set to [definedValue]>>>> [/then][else]>>>> =A0 =A0 =A0 =A0myVariable 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.. =A0but have it apply to any [var] and not on=ly 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>>>>>>> [url][content_title][/url]=3D]
[content_title]
[/hid=eif][/hideif]>>>>>>>>>>>>>> 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>>>> --------------------------------------------------------->> 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>>>
William DeVaul
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:
[AppendFile] problem (WebCat2b13 Mac .acgi) (1997)
Hard Questions ? (1997)
Cookie Newbie (2002)
Please.. copies of Digest for 7/29 and 7/30? (1997)
IIS3.0 Microsoft's Fix (1998)
No. of items in shopping cart (2000)
old mail...problem with listserv? (1998)
Searching multiple fields from one form field (1997)
emailer (1997)
Urgent help needed (1998)
Modifying order output (1997)
Fun with Dates - finally resolved but.... (1997)
Need Sample Template - just purchased (1997)
WebCatalog v2.1.1 (1998)
searching problem (1998)
Mozilla/4. and Browser Info.txt (1997)
emailer error -108 (1997)
WebCat2.0 [format thousands .0f] no go (1997)
absolute paths for databases? (1997)
WebDNA 5 - Function test weirdness or ? (2003)