Thanks Dave.
Just what I was fishing for... As a visual learner I need an example to help
understand the concept.
Here is what I have come up with. Tested, works, and solved my problem.
-------------------------
<cfset My2DArray = ArrayNew(2)>
<cfloop index="row" from="1" to="#query.RecordCount#">
<CFSET My2DArray[row][1] = "#query.var_name[row]#">
<CFSET My2DArray[row][2] = "#query.var_id[row]#">
<CFSET My2DArray[row][3] = "#query.var_count[row]#">
</cfloop>
<cfset firstLetter = "A">
<cfset count="1">
<cfif My2DArray[count][1] NEQ "">
<cfloop condition="count LTE ArrayLen(My2DArray)">
<cfif Left(My2DArray[count][1],1) NEQ firstLetter>
<cfset firstLetter = left(My2DArray[count][1],1)>
<cfset NewElement = ArrayNew(1)>
<cfset NewElement[1] = "">
<cfset NewElement[2] = "">
<cfset NewElement[3] = "">
<cfset InsertSuccess = ArrayInsertAt(My2DArray, #count#, NewElement)>
</cfif>
<cfset count = count + 1>
</cfloop>
</cfif>
------------------
----- Original Message -----
From: "Dave Watts" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, November 17, 2003 4:46 PM
Subject: RE: Inserting rows into a 2d array
> Something like this might work:
>
> <cfset My2DArray = ArrayNew(2)>
> <cfset My2DArray[1][1] = "outer 1 inner 1">
> <cfset My2DArray[1][2] = "outer 1 inner 2">
> <cfset My2DArray[2][1] = "outer 2 inner 1">
> <cfset My2DArray[2][2] = "outer 2 inner 2">
>
> <cfset NewElement = ArrayNew(1)>
> <cfset NewElement[1] = "foo">
> <cfset NewElement[2] = "bar">
>
> <cfset rs = ArrayInsertAt(My2DArray, 2, NewElement)>
>
> Note that I haven't tested this, exactly, but something close to this
should
> work. You could also create the element in place, then populate it, I
> suspect.
>
> Dave Watts, CTO, Fig Leaf Software
> http://www.figleaf.com/
> voice: (202) 797-5496
> fax: (202) 797-5444
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
- RE: Row Number variable Raymond Camden
- Re: Inserting rows into a 2d array DougF
- RE: Inserting rows into a 2d array Ian Skinner
- RE: Inserting rows into a 2d array Dave Watts
- Re: Inserting rows into a 2d array DougF
- RE: Inserting rows into a 2d array Joe Eugene
- Re: Inserting rows into a 2d array Ian Skinner
- RE: Inserting rows into a 2d array Dave Watts
- Re: Inserting rows into a 2d array DougF
- Re: Inserting rows into a 2d array Ian Skinner
- Re: Inserting rows into a 2d array DougF
- RE: Inserting rows into a 2d array Ian Skinner