CFLib.org – Common Function Library Project

arrayAppend2D(aName, value1, value2)

Last updated March 21, 2006

Version: 1 | Requires: ColdFusion 5 | Library: DataManipulationLib

 
Rated 1 time(s). Average Rating: 5.0

Description:
This UDF appends allows the user to append a key-value set to a two-dimensional array. The code is easily modifiable for more than two dimensions.

Return Values:
Returns the array.

Example:

view plain print about
<cfset aSideNav = ArrayNew(2)>
<cfset aSideNav[1][1] = "New Project">
<cfset aSideNav[1][2] = "project.cfm?ID=0">

<cfset aSideNav = arrayAppend2D(aSideNav, "Bid Results""bidresults.cfm")>

Parameters:

Name Description Required
aName The array. Yes
value1 First value. Yes
value2 Second value. Yes

Full UDF Source:

view plain print about
<cfscript>
/**
 * Appends two values to a 2D array.
 * 
 * @param aName      The array. (Required)
 * @param value1      First value. (Required)
 * @param value2      Second value. (Required)
 * @return Returns the array. 
 * @author Minh Lee Goon (contact@digeratidesignstudios.com) 
 * @version 1, March 21, 2006 
 */

function arrayAppend2D(aName, value1, value2) {
    var theLen = arrayLen(aName);
        
    aName[theLen+1][1] = value1;
    aName[theLen+1][2] = value2;
        
    return aName;
}
</cfscript>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Adam Cameron Adam Cameron added
composeDateTime
16 day(s) ago

Chris Weller Chris Weller added
convertQueryStri...
a while ago

Greg Nettles Greg Nettles added
arrayDiff
a while ago

Nathan Dintenfass Nathan Dintenfass added
ArrayOfStructsSo...
a while ago

Top Rated

Darwan Leonardo Sitepu backupDatabase
Rated 5.0, 36 time(s)

Barney Boisvert indentXml
Rated 5.0, 10 time(s)

Rachel Lehman deAccent
Rated 5.0, 6 time(s)

Isaac Dealey                                      countArbitraryDa...
Rated 5.0, 5 time(s)

Created by Raymond Camden / Design by Justin Johnson