by using the ArrayInsertAt() function:
Example:
For a 1d array:
<cfset ArrayInsertAt(myArray, 5, "myValue")>
For a 2d arary:
<cfset ArrayInsertAt(myArray, 5, ArrayNew(1))>
<cfset myArray[5][1] = whatever>
<cfset myArray[5][2] = something_else>
Problem is that 'ArrayInsertAt' will insert an element(s), but it will
overwrite what is currently at that location. What I need to do is shift the
rows of the Array down and insert a new row containing the new elements.
This adds to the array content and retains the original content of the
array.
Any ideas?
Doug
----- Original Message -----
From: "DougF" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Sunday, November 16, 2003 8:06 PM
Subject: Inserting rows into a 2d array
> Hi all,
>
> Need some help with inserting rows into a 2d array. As an example I
populate
> an array with values cityName and LocationID from a query. I then need to
> insert a new ROW between row 4 and row 5. In essence shifting rows 5 and
> below down one row. I'd thought of appending to the array, then using
> ArraySwap to move all elements down one row (need to keep elements in
> order), then using ArrayInsertAt to populate the new row at row 5. This
> seems like such an inefficient way. Any suggestions?
>
> Thanks,
> Doug
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

