Sign in to follow this  
Followers 0
andyswarbs

_ArraySort two dims doesnt seem to work

3 posts in this topic

_ArraySort in two dimensions. I keep on trying to get this to work. But try as I may somehow I think it simply don't work. Can someone either provide a worked example, or admit defeat. If the latter then I may start to work on this.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

_ArraySort in two dimensions. I keep on trying to get this to work. But try as I may somehow I think it simply don't work. Can someone either provide a worked example, or admit defeat. If the latter then I may start to work on this.

Please read the sticky at the top of the BUGs forum or post first in Support when you are not sure.

All info for a Bug report is missing so moving to Support forum.

Here is an example I have posted before that demonstrates a 2 dimension Array sorting:

#include <Array.au3>

Dim $avArray[10][2]
$avArray[0][0] = "JPM"
$avArray[1][0] = "Holger"
$avArray[2][0] = "Jon"
$avArray[3][0] = "Larry"
$avArray[4][0] = "Jeremy"
$avArray[5][0] = "Valik"
$avArray[6][0] = "Cyberslug"
$avArray[7][0] = "Nutster"
$avArray[8][0] = "Tylo"
$avArray[9][0] = "JdeB"
For $x = 0 To 9
    $avArray[$x][1] = $x
Next

; Sort on first dim
ConsoleWrite("*** Sort on first dimension" & @LF)
_ArraySort($avArray, 0, 0, 0, 2, 0)
DisplayArray($avArray)
; Sort on second dim to restore original order
ConsoleWrite("*** Sort on second dimension, restore original order" & @LF)
_ArraySort($avArray, 0, 0, 0, 2, 1)
DisplayArray($avArray)

Func DisplayArray($array)
    For $x = 0 To 9
        ConsoleWrite($avArray[$x][0] & " - " & $avArray[$x][1] & @LF)
    Next
EndFunc;==>DisplayArray
Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Jdeb, thanks for coming back on this - much appreciated. Your example works just fine. I am trying to extend the example to make sure I really understand what is going on and why I did not understand it better before. If I get somewhere with something useful I will post back here.

Share this post


Link to post
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
Sign in to follow this  
Followers 0