Jump to content

Multi key sort


Recommended Posts

This didn't work for you?

#include <Array.au3>

Dim $array[4][2]

$array[0][0] = "A"
$array[0][1] = "Z"

$array[1][0] = "B"
$array[1][1] = "A"

$array[2][0] = "C"
$array[2][1] = "A"

$array[3][0] = "A"
$array[3][1] = "B"

;_ArrayDisplay($array)

_ArraySort($array, 0,0,0,2,0)

_ArrayDisplay($array)
Edited by weaponx
Link to comment
Share on other sites

Hi,

(btw @ WeaponX, that sort only sort sequentialy on one column at a time, I think, not on subsorts for matching rows?)

See the link in my signature for Attay2D; I think the zip file wih examples is still there too.

PM me if an problems; it is aalso udes to show it is woking in the script SearchMIner in the display; it has to be converted to ArrayOfStrings by the fnction first; I had it in "Au3" pure if you can't use vbs for any reason, but it was slow on large sorts.

best Randall

$i_ColSortIndex = "2|-5|3";,[numbered by base 1 (ie first col number is "1")] [Sorts on cols 2,4,3 {DESC on 4 as NEGATIVE}]
;===============================================================================
$timerstamp3 = TimerInit()
_Array2D1DFieldSortSt($ar_TempSingle, $i_ColSortIndex);_Array2D1DFieldSortSt

[or serach forum on "subsort"]

Edited by randallc
Link to comment
Share on other sites

Hi,

Not sure what you are saying?

Do you really believe simple "ArraySort" has such a capability except by coincidence?

How yould yo get this to sort on cols 1, then with subsort on 3?

; SubsotrtWeaponX.au3
#include <Array.au3>

Dim $array[8][4]=[["C","A","A","C"],["A","A","A","D"],["D","A","D","A"],["A","A","C","B"],["C","A","A","C"],["A","A","A","D"],["D","A","D","A"],["A","A","C","B"]]

_ArrayDisplay($array)

_ArraySort($array, 0,0,0,UBound($array,2),1)

_ArrayDisplay($array)
_ArraySort($array, 0,0,0,UBound($array,2),3)

_ArrayDisplay($array)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...