CFLib.org – Common Function Library Project

arrayAppend2D(aName, value1, value2)

Last updated March 21, 2006

author

Minh Lee Goon

Version: 1 | Requires: CF5 | Library: DataManipulationLib

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:

<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:

/**
 * 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;
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson