Re: Req: Array Tags Explained, simple and clear

This WebDNA talk-list message is from

2003


It keeps the original formatting.
numero = 55137
interpreted = N
texte = You're right, the online docs for [ARRAYGET] are very confusing, for example I don't understand if you can simply call an array variable name [MyArray(1,2)] outside the [ARRAYGET] context or what the syntax is? Anyway, arrays are really useful and easy to understand once you get the hang of it. I don't have WebDNA 5 so this code won't work as displayed but hopefully I can express the concept of using a simple array in a practical way. At some point in your programming career you're going to find yourself using lots of variables like: [book1], [book2], [book3], [book4], ... etc,. This is a good sign that it might be easier to use an array. For example, we'll assume you have a "list" of your 4 current top selling books and the number of books sold for each. You might make assignments like this: [TEXT] book1=John[/TEXT] [TEXT] book2=Mark[/TEXT] [TEXT] book3=Matthew[/TEXT] [TEXT] book4=Luke[/TEXT] And then [TEXT] book1_NumSold=50[/TEXT] [TEXT] book2_NumSold=40[/TEXT] [TEXT] book3_NumSold=30[/TEXT] [TEXT] book4_NumSold=12[/TEXT] In this case you would access these values using: Our top selling book is [Books1] it has sold [book1_NumSold] copies! Or you could set up an array with these same values: [ARRAYSET NAME=Books&DIM=4,2] [/arrayset] --> creates an empty two dimensional array (think of it as a table) that looks like this: [1][2][3][4] [1] 0 0 0 0 [2]  0 0 0 0 [ARRAYSET NAME= Books] (1,1)=John&(2,1)=Mark&(3,1)=Matthew&(4,1)=Luke&(1,2)=50&(2,2)=40&(3,2)=3 0&(4,2)=12 [/ARRAYSET] Now you have an array that looks like this: [1][2][3][4] [1]JohnMarkMatthewLuke [2] 50403012 So that you can access these values using the array's variable name (again, I don't have v5 so I'm not sure of the syntax here): Our top selling book is [Books(1,1)] it has sold [Books(1,2)] copies! And the best part is that using arrays makes it easy to loop through and list all of the books: [loop start=1&end=4] Our number [index] selling book is [Books([index],1)], it has sold [Books([index],2)] copies! [/loop] Kind of a simple and silly example but I hope this helps a little. : c) Good luck! MK On Tuesday, December 30, 2003, at 11:00 AM, Palle Bo Nielsen wrote: > ... Anyway - more important. I have run through the WebDNALab tutorial > and it just ain't good enough for me. I need a real world example > doing some real stuff - not just numbers and letters. > > Anyone willing to spend some time trying to explain the Array tags > using a real world example? > > PowerPalle > Signed: Marc Kaiwi ------------------------------------------------------------- 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: Req: Array Tags Explained, simple and clear ( Donovan Brooke 2004)
  2. Re: Req: Array Tags Explained, simple and clear ( Donovan Brooke 2004)
  3. Re: Req: Array Tags Explained, simple and clear ( "Nitai @ ComputerOil" 2004)
  4. Re: Req: Array Tags Explained, simple and clear ( Palle Bo Nielsen 2004)
  5. Re: Req: Array Tags Explained, simple and clear ( Palle Bo Nielsen 2004)
  6. Re: Req: Array Tags Explained, simple and clear ( "Nitai @ ComputerOil" 2004)
  7. Re: Req: Array Tags Explained, simple and clear ( "Nitai @ ComputerOil" 2004)
  8. Re: Req: Array Tags Explained, simple and clear ( Donovan Brooke 2004)
  9. Re: Req: Array Tags Explained, simple and clear ( Marc Kaiwi 2004)
  10. Re: Req: Array Tags Explained, simple and clear ( Palle Bo Nielsen 2004)
  11. Re: Req: Array Tags Explained, simple and clear ( Marc Kaiwi 2003)
  12. Re: Req: Array Tags Explained, simple and clear ( "Nitai @ ComputerOil" 2003)
  13. Re: Req: Array Tags Explained, simple and clear ( Palle Bo Nielsen 2003)
  14. Re: Req: Array Tags Explained, simple and clear ( "Scott Anderson" 2003)
  15. Re: Req: Array Tags Explained, simple and clear ( Palle Bo Nielsen 2003)
  16. Re: Req: Array Tags Explained, simple and clear ( Phillip Bonesteele 2003)
  17. Re: Req: Array Tags Explained, simple and clear ( Donovan Brooke 2003)
  18. Req: Array Tags Explained, simple and clear ( Palle Bo Nielsen 2003)
You're right, the online docs for [ARRAYGET] are very confusing, for example I don't understand if you can simply call an array variable name [MyArray(1,2)] outside the [ARRAYGET] context or what the syntax is? Anyway, arrays are really useful and easy to understand once you get the hang of it. I don't have WebDNA 5 so this code won't work as displayed but hopefully I can express the concept of using a simple array in a practical way. At some point in your programming career you're going to find yourself using lots of variables like: [book1], [book2], [book3], [book4], ... etc,. This is a good sign that it might be easier to use an array. For example, we'll assume you have a "list" of your 4 current top selling books and the number of books sold for each. You might make assignments like this: [text] book1=John[/TEXT] [text] book2=Mark[/TEXT] [text] book3=Matthew[/TEXT] [text] book4=Luke[/TEXT] And then [text] book1_NumSold=50[/TEXT] [text] book2_NumSold=40[/TEXT] [text] book3_NumSold=30[/TEXT] [text] book4_NumSold=12[/TEXT] In this case you would access these values using: Our top selling book is [Books1] it has sold [book1_NumSold] copies! Or you could set up an array with these same values: [ARRAYSET NAME=Books&DIM=4,2] [/arrayset] --> creates an empty two dimensional array (think of it as a table) that looks like this: [1][2][3][4] [1] 0 0 0 0 [2]  0 0 0 0 [ARRAYSET NAME= Books] (1,1)=John&(2,1)=Mark&(3,1)=Matthew&(4,1)=Luke&(1,2)=50&(2,2)=40&(3,2)=3 0&(4,2)=12 [/ARRAYSET] Now you have an array that looks like this: [1][2][3][4] [1]JohnMarkMatthewLuke [2] 50403012 So that you can access these values using the array's variable name (again, I don't have v5 so I'm not sure of the syntax here): Our top selling book is [Books(1,1)] it has sold [Books(1,2)] copies! And the best part is that using arrays makes it easy to loop through and list all of the books: [loop start=1&end=4] Our number [index] selling book is [Books([index],1)], it has sold [Books([index],2)] copies! [/loop] Kind of a simple and silly example but I hope this helps a little. : c) Good luck! MK On Tuesday, December 30, 2003, at 11:00 AM, Palle Bo Nielsen wrote: > ... Anyway - more important. I have run through the WebDNALab tutorial > and it just ain't good enough for me. I need a real world example > doing some real stuff - not just numbers and letters. > > Anyone willing to spend some time trying to explain the Array tags > using a real world example? > > PowerPalle > Signed: Marc Kaiwi ------------------------------------------------------------- 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/ Marc Kaiwi

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:

WebCat editing, SiteGuard WAS:SiteAssociative lookup style? (1997) WebCat2b12 CGI Mac - [shownext] problem (1997) Running _every_ page through WebCat ? (1997) 5.0 Pricing (2003) autocommit problem (1998) Date Formats (1997) RE: Adding headers to email (1997) this works sometimes and sometimes not (1997) CC and Europe (1999) Country & Ship-to address & other fields ? (1997) Search bug. Help (2002) WebCatalog NT beta 18 problem (1997) [WebDNA] [replace] bug in v7.0? (2010) Locking up with WebCatalog... (1997) [OT] Mozilla DOM inspector (2004) autocommit problem (1998) WebCat2final1 crashes (1997) OT: Poll Please (2002) The Form authentication trick (2000) Price (2000)