|
-
May 23rd, 2003, 07:09 PM
#1
Sort a multi_dimension array??
Suppose I have a multidim array, say
Name serialNum Mileage
Benz 1111 9990
Saab 1211 9990
Benz 2111 7790
Benz 1111 9990
Fiat 1131 9990
Benz 1111 1190
Benz 1114 8890
Saab 1151 2290
Etc… you know what I mean.
I want to programmatically sort this array by name,
And mileage. What is the best way to go about it.
Does anyone have a code to do this.
Note, I dot want to use Excel's VBA code.
-
May 23rd, 2003, 08:37 PM
#2
You can use the linear sorting here (bubble sort), then just concatenate the key fields in the condition..
If arr(i,0) & arr(i,2) > arr(j,0) & arr(j,2) then
'
'
'
elseIf arr(i,0) & arr(i,2) < arr(j,0) & arr(j,2) then
'
'
'
else
'
'
'
endif
Busy 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|