Array output question

Ask a Question related to Coldfusion - Getting Started, Design and Development.

  1. #1

    Default Array output question

    Hi all, I?m trying to understand arrays. Please could someone explain to me why
    the first is ok and outputs 'Second' but the second example produces an error
    as it is a complex variable. Why is the first example ok the second not?
    <!---example1---> <CFSET aryTemp = ArrayNew(2)> <CFSET aryTemp[1][1] = 'First'>
    <CFSET aryTemp[1][2] = 'Second'> <CFSET aryTemp[2][1] = 'Third'> <CFSET
    aryTemp[2][2] = 'Fourth'> <CFOUTPUT>#aryTemp[1][2]#</CFOUTPUT> Outputs
    'Second' <!---example2---> <CFSET aryTemp = ArrayNew(2)> <CFSET aryTemp[1][1] =
    'First'> <CFSET aryTemp[1][2] = 'Second'> <CFSET aryTemp[2][1] = 'Third'>
    <CFSET aryTemp[2][2] = 'Fourth'> <CFOUTPUT>#aryTemp#</CFOUTPUT> Gives Error
    Thanks for any advice!

    Hydrowizard Guest

  2. Similar Questions and Discussions

    1. Newbie Using Arrays--Array Runs But Output is Incorrect
      I'm trying to build a dynamic table with a 2D array. My array runs, but the output which should be 00 is 000000000. My goal is to output a table...
    2. Very basic Data Output question
      I have an MSAccess database with a text field named 'field1'. The value of the records in that table are formatted as follows: #dynamic# red...
    3. psql question on echo output
      I have output set to go to a file with \o. Now I want to process a file with \i. With ECHO set to all, I would like the statement to be echoed in...
    4. newbie question links and output
      I'm creating a page for work where I have a list of the 50 states, and when one state is clicked, a pop-up comes up where it says, "Hello Arkansas,...
    5. array question (grep -v on array)
      Hi, I have an output of errors fed into an array, after which I only look at things I care about and put them in a different array: ...
  3. #2

    Default Re: Array output question

    To see the whole array structure, you can type <cfdump var="#aryTemp#">,
    but you can't just use output to see the whole thing. To do that, you
    need to loop through each value in turn and for a two-dimensional array
    you need one loop nested inside the other.

    Doug

    doug777 Guest

  4. #3

    Default Re: Array output question

    Hi

    the error itself is saying that the complex values can't be displayed using
    the cfoutput.

    Queries, arrays, and COM objects are examples of complex values.

    so we can't display these values. but as in the first example we can display
    the individual value of that complex variable.



    vkunirs Guest

  5. #4

    Default Re: Array output question

    The array does not contain a value in itself to display, but rather is a
    reference to an area of memory that contains values. You have to use the array
    notation to reference a particular value to display.

    kyle969 Guest

Posting Permissions

  • You may not post new threads
  • You may 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