Re: Boolean Tests with dereferenced arrays are broken in

This WebDNA talk-list message is from

2003


It keeps the original formatting.
numero = 53166
interpreted = N
texte = Okay, just had to refresh my memory for how we intended this to work. This is not a bug with the ArrayGet context. Here's why: The ArrayGet context was provided as a means to retrieve several array index values at once. ArrayGet expects the inner content to be a series of (x,y,z...) index tokens. You can have any WebDNA inside the ArrayGet context, but it will be pre-parsed, and is expected to parse to (x,y,z...) type tokens. For example, given the following code: [ArraySet name=array1&dim=3](1)=a&(2)=b&(3)=[/ArraySet] [ArrayGet] [loop start=1&end=3] ([index]) [/loop] [/ArrayGet] The ArrayGet context is going to pre-parse the inner content first. So this would parse to: (1) (2) (3) Then the ArrayGet context will search for and interpret any (x,y,z...) type tokens it finds, ignoring anything else that exists. So the final result is: a b c The Array tutorial demonstrates this fairly clearly, but perhaps the documentation could be improved. -----Original Message----- From: Bob Minor [mailto:bob@cybermill.com] Sent: Saturday, September 27, 2003 11:51 AM To: WebDNA Talk Subject: Boolean Tests with dereferenced arrays are broken in WebDNA 5.1d Developers are reporting the dereferenced arrays are broken. Here is the test results: [if "[test_var]" = "[none]"] The boolean engine works. Item 1 is [none]. [if "[none]" = "[none]"] The boolean engine is broken with respect to dereferenced array values. temp_var is [none]. [if "[temp_var]" = "[none]"] The boolean engine is broken with respect to dereferenced array values even if the value is deposited in a temporary variable. [if "[none]" = [interpret]"[none]"[/interpret]] The boolean engine is broken with respect to dereferenced array values even if the compared value is dereferenced by an [interpret] context. [if "[none]" = "none"] The boolean engine is broken with respect to dereferenced array values even if the compared value is a simple string. Here is the test: WebDNA version: [version]

[text]test_var=[none][/text] [raw][if "[test_var]" = "[none]"][/raw]
[if "[test_var]" = "[none]"] [then] The boolean engine works.
[/then] [else] The boolean engine is broken.
[/else] [/if] [arrayset name=test_array&dim=1](1)=[none][/arrayset] [arrayget name=test_array]
Item 1 is (1).

[raw][if "(1)" = "[none]"][/raw]
[if "(1)" = "[none]"] [then] The boolean engine works with respect to dereferenced array values. [/then] [else] The boolean engine is broken with respect to dereferenced array values.
[/else] [/if] [text]temp_var=(1)[/text]
temp_var is [temp_var].
[raw][if "[temp_var]" = "[none]"][/raw]
[if "[temp_var]" = "[none]"] [then] The boolean engine works with respect to dereferenced array values only if the value is deposited in a temporary variable.
[/then] [else] The boolean engine is broken with respect to dereferenced array values even if the value is deposited in a temporary variable.
[/else] [/if]
[raw][if "(1)" = [interpret]"[none]"[/interpret]][/raw]
[if "(1)" = [interpret]"[none]"[/interpret]] [then] The boolean engine works with respect to dereferenced array values only if the compared value is dereferenced by an [raw][interpret][/raw] context.
[/then] [else] The boolean engine is broken with respect to dereferenced array values even if the compared value is dereferenced by an [raw][interpret][/raw] context.
[/else] [/if]
[raw][if "(1)" = "none"][/raw]
[if "(1)" = "none"] [then] The boolean engine works with respect to dereferenced array values only if the compared value is a simple string.
[/then] [else] The boolean engine is broken with respect to dereferenced array values even if the compared value is a simple string.
[/else] [/if] [/arrayget] ------------------------------------------------------------- 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/ ------------------------------------------------------------- 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: Boolean Tests with dereferenced arrays are broken in ( "Scott Anderson" 2003)
  2. Re: Boolean Tests with dereferenced arrays are broken in ( "Scott Anderson" 2003)
  3. Boolean Tests with dereferenced arrays are broken in WebDNA ( Bob Minor 2003)
Okay, just had to refresh my memory for how we intended this to work. This is not a bug with the ArrayGet context. Here's why: The ArrayGet context was provided as a means to retrieve several array index values at once. ArrayGet expects the inner content to be a series of (x,y,z...) index tokens. You can have any WebDNA inside the ArrayGet context, but it will be pre-parsed, and is expected to parse to (x,y,z...) type tokens. For example, given the following code: [ArraySet name=array1&dim=3](1)=a&(2)=b&(3)=[/ArraySet] [ArrayGet] [loop start=1&end=3] ([index]) [/loop] [/ArrayGet] The ArrayGet context is going to pre-parse the inner content first. So this would parse to: (1) (2) (3) Then the ArrayGet context will search for and interpret any (x,y,z...) type tokens it finds, ignoring anything else that exists. So the final result is: a b c The Array tutorial demonstrates this fairly clearly, but perhaps the documentation could be improved. -----Original Message----- From: Bob Minor [mailto:bob@cybermill.com] Sent: Saturday, September 27, 2003 11:51 AM To: WebDNA Talk Subject: Boolean Tests with dereferenced arrays are broken in WebDNA 5.1d Developers are reporting the dereferenced arrays are broken. Here is the test results: [if "[test_var]" = "[none]"] The boolean engine works. Item 1 is [none]. [if "[none]" = "[none]"] The boolean engine is broken with respect to dereferenced array values. temp_var is [none]. [if "[temp_var]" = "[none]"] The boolean engine is broken with respect to dereferenced array values even if the value is deposited in a temporary variable. [if "[none]" = [interpret]"[none]"[/interpret]] The boolean engine is broken with respect to dereferenced array values even if the compared value is dereferenced by an [interpret] context. [if "[none]" = "none"] The boolean engine is broken with respect to dereferenced array values even if the compared value is a simple string. Here is the test: WebDNA version: [version]

[text]test_var=[none][/text] [raw][if "[test_var]" = "[none]"][/raw]
[if "[test_var]" = "[none]"] [then] The boolean engine works.
[/then] [else] The boolean engine is broken.
[/else] [/if] [arrayset name=test_array&dim=1](1)=[none][/arrayset] [arrayget name=test_array]
Item 1 is (1).

[raw][if "(1)" = "[none]"][/raw]
[if "(1)" = "[none]"] [then] The boolean engine works with respect to dereferenced array values. [/then] [else] The boolean engine is broken with respect to dereferenced array values.
[/else] [/if] [text]temp_var=(1)[/text]
temp_var is [temp_var].
[raw][if "[temp_var]" = "[none]"][/raw]
[if "[temp_var]" = "[none]"] [then] The boolean engine works with respect to dereferenced array values only if the value is deposited in a temporary variable.
[/then] [else] The boolean engine is broken with respect to dereferenced array values even if the value is deposited in a temporary variable.
[/else] [/if]
[raw][if "(1)" = [interpret]"[none]"[/interpret]][/raw]
[if "(1)" = [interpret]"[none]"[/interpret]] [then] The boolean engine works with respect to dereferenced array values only if the compared value is dereferenced by an [raw][interpret][/raw] context.
[/then] [else] The boolean engine is broken with respect to dereferenced array values even if the compared value is dereferenced by an [raw][interpret][/raw] context.
[/else] [/if]
[raw][if "(1)" = "none"][/raw]
[if "(1)" = "none"] [then] The boolean engine works with respect to dereferenced array values only if the compared value is a simple string.
[/then] [else] The boolean engine is broken with respect to dereferenced array values even if the compared value is a simple string.
[/else] [/if] [/arrayget] ------------------------------------------------------------- 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/ ------------------------------------------------------------- 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/ "Scott Anderson"

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:

WebCat2b13MacPlugIn - More limits on [include] (1997) Emailer.Out (1998) A multi-processor savvy WebCatalog? (1997) WebCatalog Q & A pages (1997) Extended [ConvertChars] (1997) carriage returns in data (1997) [WebDNA] strange characters in db (2009) List Address Changed! (1998) Hiding Email Addresses (2003) Generating unique SKU from [cart] - Still Stumped... (1997) Problems passing [SKU] with $Replace in 2.0 (1997) WebTV (1998) 404 error -- but wc code executes... (2001) 2 Nt's (1998) Re:listfiles-looking for slick solution (1997) AAAH: stupid sendmail (2001) searchable list archive (1997) [WebDNA] Help me install (2012) spawn (1998) [WebDNA] [thisurlplusget] and the correct use of (2013)