?
Solved

Coldfusion ArrayPrepend Question

Posted on 2004-10-06
1
Medium Priority
?
392 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
reggi635 earned 500 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

WordPress Tutorial 2: Terminology

An important part of learning any new piece of software is understanding the terminology it uses. Thankfully WordPress uses fairly simple names for everything that make it easy to start using the software.

Question has a verified solution.

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

This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

771 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