Re: Req: Array Tags Explained, simple and clear

This WebDNA talk-list message is from

2004


It keeps the original formatting.
numero = 55143
interpreted = N
texte = Hi Marc, Thanks a lot for spending some time trying to explain the Array tags for me. I have a couple of questions before I might get (understand) it ;) So what your are telling me is that the Array function is mostly, if not only, used when working with template variables, or? Your "top selling books" example. Let's say your have a database of 10.000 books in your WebDNA database, with 10.000 names and 10.000 NumSold fields. Why just not do a normal Search and Sort to see the top 4 selling books? How does the Array tag come handy here? I really need to see the difference in using a normal Search and Sort function compared to the Array function... I'm just a bit confused here... and really need to learn the Array function. Currently I have a quite large Forum system build up using WebDNA and I hope that the Array function will give me some new possibilities towards performance and functionality. Hope to hear from you soon again. Palle On 31/12-2003, at 19.28, Marc Kaiwi wrote: > 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)= > 30&(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/ > > -- Venlig hilsen Palle B. Nielsen (PowerPalle) http://www.macnyt.dk/ ------------------------------------------------------------- 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)
Hi Marc, Thanks a lot for spending some time trying to explain the Array tags for me. I have a couple of questions before I might get (understand) it ;) So what your are telling me is that the Array function is mostly, if not only, used when working with template variables, or? Your "top selling books" example. Let's say your have a database of 10.000 books in your WebDNA database, with 10.000 names and 10.000 NumSold fields. Why just not do a normal Search and Sort to see the top 4 selling books? How does the Array tag come handy here? I really need to see the difference in using a normal Search and Sort function compared to the Array function... I'm just a bit confused here... and really need to learn the Array function. Currently I have a quite large Forum system build up using WebDNA and I hope that the Array function will give me some new possibilities towards performance and functionality. Hope to hear from you soon again. Palle On 31/12-2003, at 19.28, Marc Kaiwi wrote: > 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)= > 30&(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/ > > -- Venlig hilsen Palle B. Nielsen (PowerPalle) http://www.macnyt.dk/ ------------------------------------------------------------- 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/ Palle Bo Nielsen

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:

SiteEdit Pro, DataBase Helper and Europe (2000) WebCat2 - Getting to the browser's username/password data (1997) WC2.0 Memory Requirements (1997) Help formatting search results w/ table (1997) Request Time Out (1997) writing db to disk (1997) WebDNA performance comparisons? (2004) MacActivity and PCS (1997) [WebDNA] Is there a good file upload script available these days? (2009) One more time (1997) [WebDNA] Sorry WebDNA server not running /Template ERROR/ Slow speeds (2019) target=_blank and form variables (1997) [sendmail] on NT? (1997) Mac Lockup Problems (1998) Generating Report Totals (1997) [protect admin] (1997) web hosting (2000) HELP!!! (1998) [shownext max=?] armed (1997) WebCatalog 2.0 & WebDNA docs in HTML ... (1997)