Re: [WebDNA] is this expected behavior for [arrayget]?
This WebDNA talk-list message is from 2009
It keeps the original formatting.
numero = 103225
interpreted = N
texte = John Butler wrote:> Is anyone out there using [arrayset] or [arrayget] ??> > I am starting to, but finding some un-desired behavior.> There are certainly other ways of accomplishing what I am doing.. but I > thought it would be fun to learn webdna's array syntax.> I would love to rely on this and learn it well while developing, but I > am under enough time pressure to want to avoid being the lone scout in > this territory. Thus my question.. Has anyone spent much time with > webdna arrays? What did you find.. Work as expected? Or what are the > issues?> > Here is an example of one issues I am finding. (I hope it is just due > to my own misunderstanding, and not webdna source-code bugs/features! ;-)> > this code:> > ---------------------------------------------------------------------------------------------------- > > [arrayset > name=ReqdFormVars&dim=12](1)=UserID&(2)=EnterPassword&(3)=ReEnterPassword&(4)=FirstName&(5)=LastName&(6)=Address[!] > > [/!]&(7)=City&(8)=State&(9)=PostalCodeZip&(10)=Country&(11)=PhoneNumber&(12)=EMailAddress[/arrayset] > > > [ArrayGet name=ReqdFormVars]> [loop start=1&end=[DimSize_1]&advance=1]> [index]-([index])=([index]),[interpret][([index])][/interpret].[!]> [/!][text show=F]testvar[index]=([index])[/text][!]> [/!][/loop]> [/ArrayGet]> > testvar1=[testvar1]> testvar1=[interpret][[testvar1]][/interpret]> testvar12=[testvar12]> testvar12=[interpret][[testvar12]][/interpret]> UserID=[UserID]> EMailAddress=[EMailAddress]> ---------------------------------------------------------------------------------------------------- > > > returns:> > =========================================================> 1-UserID=UserID,[UserID].> 2-EnterPassword=EnterPassword,[EnterPassword].> 3-ReEnterPassword=ReEnterPassword,[ReEnterPassword].> 4-FirstName=FirstName,[FirstName].> 5-LastName=LastName,[LastName].> 6-Address=Address,[Address].> 7-City=City,[City].> 8-State=State,[State].> 9-PostalCodeZip=PostalCodeZip,[PostalCodeZip].> 10-Country=Country,[Country].> 11-PhoneNumber=PhoneNumber,[PhoneNumber].> 12-EMailAddress=EMailAddress,[EMailAddress].> > > testvar1=(1)> testvar1=[(1)]> testvar12=(12)> testvar12=[(12)]> UserID=thisIsATestUser> EMailAddress=thisIsATestEmail> =========================================================> Why does (1) not evaluate to "UserID" when *inside* the [text] context > which is inside the [arrayget], like it does when *outside* the [text]?> Why does [interpret] not work inside the [arrayget]?Hey govinda,Not sure why [interpret][/interpret] tags are not working.. maybe something to do with variable scoping..Are these formvalues?Below works with listvariables.. so I'm guessing it will work with formvariables:---[text multi=T]UserID=someuser&EMailAddress=test@test.com[/text][arrayset name=ReqdFormVars&dim=12](1)=UserID&(2)=EnterPassword&(3)=ReEnterPassword&(4)=FirstName&(5)=LastName&(6)=Address[!] [/!]&(7)=City&(8)=State&(9)=PostalCodeZip&(10)=Country&(11)=PhoneNumber&(12)=EMailAddress[/arrayset][ArrayGet name=ReqdFormVars]Num Dims: [numdims]
[loop start=1&end=[DimSize_1]&advance=1] [index]-([index])=([index]),[listvariables name=[ReqdFormVars([index])]&type=text][value][/listvariables].
[!] [/!][text]testvar[index]=[ReqdFormVars([index])][/text][!] [/!][/loop][/ArrayGet]
testvar1=[testvar1]
testvar1=[interpret][[testvar1]][/interpret]
testvar12=[testvar12]
testvar12=[interpret][[testvar12]][/interpret]
UserID=[UserID]
EMailAddress=[EMailAddress]
---Alternatively, you can use the global syntax:---[text multi=T]UserID=someuser&EMailAddress=test@test.com[/text][arrayset name=ReqdFormVars&dim=12](1)=UserID&(2)=EnterPassword&(3)=ReEnterPassword&(4)=FirstName&(5)=LastName&(6)=Address[!] [/!]&(7)=City&(8)=State&(9)=PostalCodeZip&(10)=Country&(11)=PhoneNumber&(12)=EMailAddress[/arrayset] [loop start=1&end=[ReqdFormVars(DimSize_1)]&advance=1] [index]-[ReqdFormVars([index])]=[ReqdFormVars([index])],[interpret][[ReqdFormVars([index])]][/interpret].
[!] [/!][text]testvar[index]=[interpret][[ReqdFormVars([index])]][/interpret][/text][!] [/!][/loop]
testvar1=[testvar1]
testvar12=[testvar12]
UserID=[UserID]
EMailAddress=[EMailAddress]
---Donovan-- Donovan BrookeWebDNA Software Corporationhttp://www.webdna.us**[Square Bracket Utopia]**
Associated Messages, from the most recent to the oldest:
John Butler wrote:> Is anyone out there using [arrayset] or [arrayget] ??> > I am starting to, but finding some un-desired behavior.> There are certainly other ways of accomplishing what I am doing.. but I > thought it would be fun to learn webdna's array syntax.> I would love to rely on this and learn it well while developing, but I > am under enough time pressure to want to avoid being the lone scout in > this territory. Thus my question.. Has anyone spent much time with > webdna arrays? What did you find.. Work as expected? Or what are the > issues?> > Here is an example of one issues I am finding. (I hope it is just due > to my own misunderstanding, and not webdna source-code bugs/features! ;-)> > this code:> > ---------------------------------------------------------------------------------------------------- > > [arrayset > name=ReqdFormVars&dim=12](1)=UserID&(2)=EnterPassword&(3)=ReEnterPassword&(4)=FirstName&(5)=LastName&(6)=Address
[!] > > [/!]&(7)=City&(8)=State&(9)=PostalCodeZip&(10)=Country&(11)=PhoneNumber&(12)=EMailAddress[/arrayset] > > > [ArrayGet name=ReqdFormVars]> [loop start=1&end=[DimSize_1]&advance=1]> [index]-([index])=([index]),
[interpret][([index])][/interpret].
[!]> [/!][text show=F]testvar[index]=([index])[/text]
[!]> [/!][/loop]> [/ArrayGet]> > testvar1=[testvar1]> testvar1=
[interpret][[testvar1]][/interpret]> testvar12=[testvar12]> testvar12=
[interpret][[testvar12]][/interpret]> UserID=[UserID]> EMailAddress=[EMailAddress]> ---------------------------------------------------------------------------------------------------- > > > returns:> > =========================================================> 1-UserID=UserID,[UserID].> 2-EnterPassword=EnterPassword,[EnterPassword].> 3-ReEnterPassword=ReEnterPassword,[ReEnterPassword].> 4-FirstName=FirstName,[FirstName].> 5-LastName=LastName,[LastName].> 6-Address=Address,[Address].> 7-City=City,[City].> 8-State=State,[State].> 9-PostalCodeZip=PostalCodeZip,[PostalCodeZip].> 10-Country=Country,[Country].> 11-PhoneNumber=PhoneNumber,[PhoneNumber].> 12-EMailAddress=EMailAddress,[EMailAddress].> > > testvar1=(1)> testvar1=[(1)]> testvar12=(12)> testvar12=[(12)]> UserID=thisIsATestUser> EMailAddress=thisIsATestEmail> =========================================================> Why does (1) not evaluate to "UserID" when *inside* the
[text] context > which is inside the [arrayget], like it does when *outside* the
[text]?> Why does
[interpret] not work inside the [arrayget]?Hey govinda,Not sure why
[interpret][/interpret] tags are not working.. maybe something to do with variable scoping..Are these formvalues?Below works with listvariables.. so I'm guessing it will work with formvariables:---[text multi=T]UserID=someuser&EMailAddress=test@test.com[/text][arrayset name=ReqdFormVars&dim=12](1)=UserID&(2)=EnterPassword&(3)=ReEnterPassword&(4)=FirstName&(5)=LastName&(6)=Address
[!] [/!]&(7)=City&(8)=State&(9)=PostalCodeZip&(10)=Country&(11)=PhoneNumber&(12)=EMailAddress[/arrayset][ArrayGet name=ReqdFormVars]Num Dims: [numdims]
[loop start=1&end=[DimSize_1]&advance=1] [index]-([index])=([index]),[listvariables name=[ReqdFormVars([index])]&type=text][value][/listvariables].
[!] [/!]
[text]testvar[index]=[ReqdFormVars([index])][/text]
[!] [/!][/loop][/ArrayGet]
testvar1=[testvar1]
testvar1=
[interpret][[testvar1]][/interpret]
testvar12=[testvar12]
testvar12=
[interpret][[testvar12]][/interpret]
UserID=[UserID]
EMailAddress=[EMailAddress]
---Alternatively, you can use the global syntax:---[text multi=T]UserID=someuser&EMailAddress=test@test.com[/text][arrayset name=ReqdFormVars&dim=12](1)=UserID&(2)=EnterPassword&(3)=ReEnterPassword&(4)=FirstName&(5)=LastName&(6)=Address
[!] [/!]&(7)=City&(8)=State&(9)=PostalCodeZip&(10)=Country&(11)=PhoneNumber&(12)=EMailAddress[/arrayset] [loop start=1&end=[ReqdFormVars(DimSize_1)]&advance=1] [index]-[ReqdFormVars([index])]=[ReqdFormVars([index])],
[interpret][[ReqdFormVars([index])]][/interpret].
[!] [/!]
[text]testvar[index]=
[interpret][[ReqdFormVars([index])]][/interpret][/text]
[!] [/!][/loop]
testvar1=[testvar1]
testvar12=[testvar12]
UserID=[UserID]
EMailAddress=[EMailAddress]
---Donovan-- Donovan BrookeWebDNA Software Corporationhttp://www.webdna.us**[Square Bracket Utopia]**
Donovan Brooke
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:
delete and return to founditems (2002)
Sample Tearoom Search Error - Solved! (1997)
[group] ? (1997)
gateway application timeouts (1998)
Quit revisited (1997)
[ot] ShowIf & HideIf Question (1998)
[OT] Mom's gift (2006)
Search Engine questions ... (2002)
[SearchString] problem with [search] context (1997)
Merry Christmas (2006)
syntax question, not in online refernce (1997)
Nested vs conditional (1997)
Looking up two prices in Formulas.db (1997)
Test! (2003)
Misunderstanding?? (1997)
[searchString] (1997)
macosx 1 process, linux N processes, macosx chokes under load (2001)
[WebDNA] [switch] [case] only works with "=" comparisons.. true? (2009)
WebCat b13 CGI -shownext- (1997)
RE: Emailer prefs in two places ... (1997)