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

Tayo Akinmade Tayo Akinmade added
arrayTrim
11 day(s) ago

Will Belden Will Belden added
longTime
17 day(s) ago

James Sleeman James Sleeman added
quickSort
27 day(s) ago

Ben Forta Ben Forta added
GetHostAddress
30 day(s) ago

Top Rated

Darwan Leonardo Sitepu EksporSQLData
Rated 5.0, 16 time(s)

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

Barney Boisvert indentXml
Rated 5.0, 10 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 4 time(s)

Created by Raymond Camden / Design by Justin Johnson