Jump to content

_ArraySort For multiple dimensions Example


Recommended Posts

I am trying to sort a Multi Dimension array using the _ArraySort() and I can't seem to figure it out.

Also, there is no example in the help file for using Multiple Dimension Arrays.

Here is what I have been playing with. I want to be able to sort using the Second dimension.

#include <Array.au3>

Dim $aAppInstall[2][5] = [["Third", "Second", "Fourth", "First", "Fifth"], [3,2,4,1,5]]

_ArrayDisplay($aAppInstall, "UnSorted")
_ArraySort($aAppInstall, 1, 1, 2, 5, 1);<- What's Wrong?
_ArrayDisplay($aAppInstall, "Sorted")

Thanks,

Mike

Edited by MikeOsdx
Link to comment
Share on other sites

  • Developers

try this:

#Tidy_Parameters=/rel 1
#include <Array.au3>
Dim $aAppInstall[5][2] = [[ "First", 1],["Third", 3],["Second", 2],["Fourth",4],["Fifth",5 ]]
_ArrayDisplay($aAppInstall, "UnSorted")
_ArraySort($aAppInstall, 1, 0, 0, 2, 0)
_ArrayDisplay($aAppInstall, "Sorted by name column 1 descending..")
_ArraySort($aAppInstall, 1, 0, 0, 2, 1)
_ArrayDisplay($aAppInstall, "Sorted number column 2 descending..")

<_<

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...