Professional Web Applications Themes

Nested arrays & probability - Coldfusion - Advanced Techniques

Let say I have a 2D array; myarray[1][1]="A" myarray[1][2]="B" myarray[1][3]="C" myarray[2][1]="D" myarray[3][1]="E" myarray[3][2]="F"...

Sponsored Links
  1. #1

    Default Nested arrays & probability

    Let say I have a 2D array;
    myarray[1][1]="A"
    myarray[1][2]="B"
    myarray[1][3]="C"
    myarray[2][1]="D"
    myarray[3][1]="E"
    myarray[3][2]="F"
    Sponsored Links
    Neotoxin Guest

  2. #2

    Default Re: Nested arrays & probability

    First of all, you can not use the "+" to concatenate two alphabetic strings. You must use "&":
    nextarray[1]=myarray[1][1] & myarray[2][1] & myarray[3][1] &...


    jdeline Guest

  3. #3

    Default Re: Nested arrays & probability

    Ok. I'll take note, but can someone show me how to make those loops...
    Neotoxin Guest

  4. #4

    Default Re: Nested arrays & probability

    Btw, I forgot to mention that the same thing can be done using index looping,
    if I'm using 1D array that contain lists, for example:
    <cfset myarray=ArrayNew(1)>
    <cfset myarray[1]="A,B,C,D">
    <cfset myarray[2]="E,F">
    <cfset myarray[3]="G,H,I">
    <cfloop index="p" list="#myarray[1]#" delimiter=",">
    <cfloop index="q" list="#myarray[2]#" delimiter=",">
    <cfloop index="r" list="#myarray[3]#" delimiter=",">
    <cfoutput>#p##q##r#<br></cfoutput>
    </cfloop>
    </cfloop>
    </cfloop>

    The only problem is, by using that method, the number of nested loops depend
    on the myarray's length. What if the myarray's length is dynamic (could be
    1,2,3,...or 100 maybe)?. Is it possible to use a predefined template and use
    <cfinclude> inside the loop? If it is, how would I do it?

    Neotoxin Guest

Similar Threads

  1. Nesting Arrays within arrays.
    By JimmySlam in forum Macromedia Flash Ad Development
    Replies: 3
    Last Post: March 15th, 09:42 AM
  2. XMLConnector complex example with nested arrays
    By blumunky in forum Macromedia Flash Data Integration
    Replies: 0
    Last Post: December 12th, 07:47 PM
  3. simple probability problem using PERL
    By Charles Lu in forum PERL Beginners
    Replies: 4
    Last Post: January 26th, 03:09 PM
  4. #25262 [Bgs]: Nested arrays in POST not processed correctly
    By jal at ambitonline dot com in forum PHP Development
    Replies: 0
    Last Post: August 27th, 04:20 AM
  5. Make Huge $$$$'s through Statistics & Probability
    By DavidHW68 in forum Macromedia Freehand
    Replies: 4
    Last Post: July 9th, 06:28 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139