Solved

Coldfusion ArrayPrepend Question

Posted on 2004-10-06
1
384 Views
Last Modified: 2013-12-16

How can I use ArrayPrepend() to add an element to a 2d array?

<!--- Set Route-Airport-Country Array --->
<cfset countToo=js_route_airport_country.recordCount>
<cfloop index="i" from="1" to="#countToo#">
 <cfset airportArray[i][1]='#js_route_airport_country.country_desc[i]#'>
 <cfset airportArray[i][2]='#js_route_airport_country.airport_desc[i]#'>
 <cfset airportArray[i][3]='a#js_route_airport_country.airport_code[i]#'>
 <cfset airportArray[i][4]='#DateFormat(js_route_airport_country.start_date[i], "yyyymm")#'>
 <cfset airportArray[i][5]='#DateFormat(js_route_airport_country.end_date[i], "yyyymm")#'>
</cfloop>
   <cfdump var="#airportArray#">


Many thanks,
Michelle
0
Comment
Question by:mjacobs2929
1 Comment
 
LVL 4

Accepted Solution

by:
reggi635 earned 125 total points
ID: 12238946
ArrayAppend works good for a Single dim array.
ArrayInsetAt would server ur purpose.
Something like this :
<cfscript>
    appendValues = ArrayNew(1);
    appendValues[ 1 ] = "d1";
    appendValues[ 2 ] = "d2";
    appendValues[ 3 ] = "d3";
    appendValues[ 3 ] = "d4";
    appendValues[ 3 ] = "d5";
    ArrayInsertAt(airportArray, 1, appendValues);
</cfscript>

Even this should work as well
<CFSET airportArray[ ArrayLen(airportArray) + 1 ][ 1 ] = "d1">
so on .......

REGGI

0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now