Re: [URL] and [showif] or [hideif] comparisons

This WebDNA talk-list message is from

2003


It keeps the original formatting.
numero = 53746
interpreted = N
texte = It's not something that WebDNA CAN do automatically (at least not without a philosophical change in its parsing method). It's a matter of parsing the [showif] or [hideif] syntax. It's been explained here before, but basically, WebDNA is an inside-out parser. Given: [showif [var1]=[var2]] WebDNA first substitutes the appropriate values for the [var1] and [var2] pairs, then evaluates the [showif]. So, if [var1] and [var2] both contain a=b, you end up with: [showif a=b=a=b] WebDNA then uses the first comparison operator it finds (an arbitrary but reasonable choice) and finds that "a" does not equal "b=a=b", so WebDNA bypasses the contents of the showif context - even though in [var1] and [var2] are equal. By url'ing the variables: [showif [url][var1][/url]=[url][var2][/url]] the same values parse out to: [showif a%3Db=a%3Db] and WebDNA rightly determines that the expression evaluates true. It would be possible for WebDNA to first find the operator then perform the substitutions and comparisons, this would be contrary to the way the WebDNA parser has worked since the beginning (7 or 8 years ago? I've been using it since 1997 I think). It would also remove the seldom used but powerful technique of storing an operator or even a full comparison expression in a variable (or database field or form variable) then using that variable in your showif. For example: [text]operator==[/text] .... other code that might in some circumstance set... [text]operator=![/text] .... later on the page, use the operator you decided on earlier ... [showif [url][var1][/url][operator][url][var2][/url]] ... good stuff, depending on the value of [operator] whether var1 and var2 should be equal or not equal ... [/showif] My recommendation... get used to using [url] ANY TIME THE VALUE OF A VARIABLE COULD CONCEIVABLY CONTAIN A PROBLEM CHARACTER. This means a comparison operator for a [showif]/[hideif], quotes for an [if], ampersands and equals signs for any named parameter to a WebDNA tag (like [include file=abc.incl¶m=[url][var1][/url]]) or field value for an [append]/[replace]/[orderfile]. URL is your friend. It's like using parentheses in a math expression: 5 * (6 + 7) is different than 5 * 6 + 7. - brian On Thursday, October 30, 2003, at 03:41 PM, Tim Robinson wrote: > Yes. So would it slow everything down enormously if the showif and > hideif > did it automatically? > > Regards, > Tim > -- > Tim Robinson > IDFK Web Developments > tim@idfk.com.au > 114a/40 Yeo Street > Neutral Bay 2089 > Australia > Phone +612 9908 2134 > Fax +612 9908 4837 > >> From: Jesse Proudman >> Reply-To: (WebDNA Talk) >> Date: Thu, 30 Oct 2003 15:37:56 -0800 >> To: (WebDNA Talk) >> Subject: Re: [URL] and [showif] or [hideif] comparisons >> >> >> On Oct 30, 2003, at 3:36 PM, Dan Strong wrote: >> >>> Why? (Seriously. besides the fact that I couldn't get it to work this >>> one time. All other show/hides I've ever done have worked...) >>>> >>>> Is there any benefit for NOT using [url]? And if there isn't, why >>>> isn't it >>>> implied in the [showif] and [hideif] contexts so they always did it? >>>> Maybe >>>> it would slow everything up considerably for number comparisons or >>>> something? >>> >>> I'd love to know this... I have never done this before, and I have >>> seen nothing indicating that I should (until today). >> >> Because if your description field is: >> >> Great House! >> >> and your comparison is: >> >> [showif [description]=] >> >> WebDNA will interpret it as: >> >> [showif Great House!=] >> >> Which means showif Great House doesn't equal '=' >> >> This is covered in the archives quite a few times if my description >> doesn't cut it. >> >> -- >> Jesse Williams-Proudman >> Blue Box Development :: Custom Web Solutions >> -- Brian Fries, BrainScan Software -- http://www.brainscansoftware.com -- ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: [URL] and [showif] or [hideif] comparisons ( Joe D'Andrea 2003)
  2. Re: [URL] and [showif] or [hideif] comparisons ( Brian Fries 2003)
  3. Re: [URL] and [showif] or [hideif] comparisons ( "Dan Strong" 2003)
  4. Re: [URL] and [showif] or [hideif] comparisons ( Tim Robinson 2003)
  5. Re: [URL] and [showif] or [hideif] comparisons ( Jesse Proudman 2003)
  6. Re: [URL] and [showif] or [hideif] comparisons ( "Dan Strong" 2003)
  7. [URL] and [showif] or [hideif] comparisons ( Tim Robinson 2003)
It's not something that WebDNA CAN do automatically (at least not without a philosophical change in its parsing method). It's a matter of parsing the [showif] or [hideif] syntax. It's been explained here before, but basically, WebDNA is an inside-out parser. Given: [showif [var1]=[var2]] WebDNA first substitutes the appropriate values for the [var1] and [var2] pairs, then evaluates the [showif]. So, if [var1] and [var2] both contain a=b, you end up with: [showif a=b=a=b] WebDNA then uses the first comparison operator it finds (an arbitrary but reasonable choice) and finds that "a" does not equal "b=a=b", so WebDNA bypasses the contents of the showif context - even though in [var1] and [var2] are equal. By url'ing the variables: [showif [url][var1][/url]=[url][var2][/url]] the same values parse out to: [showif a%3Db=a%3Db] and WebDNA rightly determines that the expression evaluates true. It would be possible for WebDNA to first find the operator then perform the substitutions and comparisons, this would be contrary to the way the WebDNA parser has worked since the beginning (7 or 8 years ago? I've been using it since 1997 I think). It would also remove the seldom used but powerful technique of storing an operator or even a full comparison expression in a variable (or database field or form variable) then using that variable in your showif. For example: [text]operator==[/text] .... other code that might in some circumstance set... [text]operator=![/text] .... later on the page, use the operator you decided on earlier ... [showif [url][var1][/url][operator][url][var2][/url]] ... good stuff, depending on the value of [operator] whether var1 and var2 should be equal or not equal ... [/showif] My recommendation... get used to using [url] ANY TIME THE VALUE OF A VARIABLE COULD CONCEIVABLY CONTAIN A PROBLEM CHARACTER. This means a comparison operator for a [showif]/[hideif], quotes for an [if], ampersands and equals signs for any named parameter to a WebDNA tag (like [include file=abc.incl¶m=[url][var1][/url]]) or field value for an [append]/[replace]/[orderfile]. URL is your friend. It's like using parentheses in a math expression: 5 * (6 + 7) is different than 5 * 6 + 7. - brian On Thursday, October 30, 2003, at 03:41 PM, Tim Robinson wrote: > Yes. So would it slow everything down enormously if the showif and > hideif > did it automatically? > > Regards, > Tim > -- > Tim Robinson > IDFK Web Developments > tim@idfk.com.au > 114a/40 Yeo Street > Neutral Bay 2089 > Australia > Phone +612 9908 2134 > Fax +612 9908 4837 > >> From: Jesse Proudman >> Reply-To: (WebDNA Talk) >> Date: Thu, 30 Oct 2003 15:37:56 -0800 >> To: (WebDNA Talk) >> Subject: Re: [url] and [showif] or [hideif] comparisons >> >> >> On Oct 30, 2003, at 3:36 PM, Dan Strong wrote: >> >>> Why? (Seriously. besides the fact that I couldn't get it to work this >>> one time. All other show/hides I've ever done have worked...) >>>> >>>> Is there any benefit for NOT using [url]? And if there isn't, why >>>> isn't it >>>> implied in the [showif] and [hideif] contexts so they always did it? >>>> Maybe >>>> it would slow everything up considerably for number comparisons or >>>> something? >>> >>> I'd love to know this... I have never done this before, and I have >>> seen nothing indicating that I should (until today). >> >> Because if your description field is: >> >> Great House! >> >> and your comparison is: >> >> [showif [description]=] >> >> WebDNA will interpret it as: >> >> [showif Great House!=] >> >> Which means showif Great House doesn't equal '=' >> >> This is covered in the archives quite a few times if my description >> doesn't cut it. >> >> -- >> Jesse Williams-Proudman >> Blue Box Development :: Custom Web Solutions >> -- Brian Fries, BrainScan Software -- http://www.brainscansoftware.com -- ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Brian Fries

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:

This Code Kills My WebCatalog Dead (2003) Attn: Bug in GeneralStore example b15 (1997) select multiple (1997) Upcoming 2.1 Release and PCS Committment (1997) E-mail loop ! (1997) Help name our technology! (1997) Assigning carts (1998) California Tax Rates (1998) [Announce] WebCatalog 3.0 Beta Program (1998) [WebDNA] a major shift in strategy? (2008) HTTP header line is too long? (1997) OT: javascript help (2003) SiteCheck & WebCat ? (1997) Great product and great job ! (1997) E-Mailer (WebCatb15acgiMac) (1997) WCS Newbie question (1997) Unexpected error (1997) Setting up shop (1997) carriage returns in data (1997) Null Chars (1999)