|
Home > Archive > IIS ASP > May 2007 > Alpha multidimensional array sort
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Alpha multidimensional array sort
|
|
| glbdev@gmail.com 2007-05-25, 1:18 pm |
| I have a multidimensional array with 5 keys. I need to perform a
alpha sort on the 3rd key. Does anyone have an example on how to do
this?
Here is an example of what my array consists of:
mArray(i,0) = '2007-05-02"
mArray(i,1) = "6:00pm"
mArray(i,2) = "TEXT TEXT TEXT" <------------------ NEED TO DO ALPHA
SORT ON THIS KEY ----------------<<
mArray(i,3) = 6
mArray(i,4) = 4
Thanks,
Steve
| |
| Bob Barrows [MVP] 2007-05-25, 7:16 pm |
| glbdev@gmail.com wrote:
> I have a multidimensional array with 5 keys. I need to perform a
> alpha sort on the 3rd key. Does anyone have an example on how to do
> this?
>
> Here is an example of what my array consists of:
>
> mArray(i,0) = '2007-05-02"
> mArray(i,1) = "6:00pm"
> mArray(i,2) = "TEXT TEXT TEXT" <------------------ NEED TO DO ALPHA
> SORT ON THIS KEY ----------------<<
> mArray(i,3) = 6
> mArray(i,4) = 4
>
>
Put the data into an ad hoc recordset and use its Sort method:
dim rs
Const adDBTimeStamp = 135
Const adVarChar = 200
Const adInteger = 3
set rs=createobject("adodb.recordset")
With rs.Fields
.Append "fDate",adDBTimeStamp
.Append "fTime",adDBTimeStamp
.Append "fText",adVarChar,50
.Append "fNum1",adInteger
.Append "fNum2",adInteger
End With
rs.Open
'loop through the array:
rs.AddNew Array(mArray(i,0),mArray(i,1),mArray(i,2
),mArray(i,3), _
mArray(i,4))
'etc.
'end loop
rs.Sort "fText"
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
| |
| glbdev@gmail.com 2007-05-25, 7:16 pm |
| On May 25, 2:27 pm, "Bob Barrows [MVP]" <reb01...@NOyahoo.SPAMcom>
wrote:
> glb...@gmail.com wrote:
>
>
>
> Put the data into an ad hoc recordset and use its Sort method:
>
> dim rs
> Const adDBTimeStamp = 135
> Const adVarChar = 200
> Const adInteger = 3
> set rs=createobject("adodb.recordset")
> With rs.Fields
> .Append "fDate",adDBTimeStamp
> .Append "fTime",adDBTimeStamp
> .Append "fText",adVarChar,50
> .Append "fNum1",adInteger
> .Append "fNum2",adInteger
> End With
> rs.Open
>
> 'loop through the array:
> rs.AddNew Array(mArray(i,0),mArray(i,1),mArray(i,2
),mArray(i,3), _
> mArray(i,4))
> 'etc.
> 'end loop
> rs.Sort "fText"
>
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
Thanks BOB ... that worked!!!
- Steve
|
|
|
|
|