Solved

Coldfusion ArrayPrepend Question

Posted on 2004-10-06
1
386 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Xsl Nested Loop 4 29
Select distinct 25 98
move expression web site to a new server 12 29
Grunt script for Build Process 1 25
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

786 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