Jump to content
Sign in to follow this  

_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")



Edited by MikeOsdx

Share this post

Link to post
Share on other sites

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


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
Live for the present,
Dream of the future,
Learn from the past.

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.