Jump to content

Recommended Posts

Posted

Hi,

I'm trying to sort a 2D array:

[0]|Microsoft Windows|XP|x86|German

[1]|Microsoft Windows|XP|x86|English_US

[2]|Microsoft Windows|General|x86|German

[3]|Microsoft Windows|General|x86|English_US

[4]|Microsoft Windows|General|x86|Global

[5]|Microsoft Windows|Vista|x64|Global

[6]|Microsoft Windows|Vista|x86|Global

[7]|Microsoft Windows|2000|x86|German

[8]|Microsoft Windows|2000|x86|English_US

[9]|Microsoft Office|2007|x64|Global

[10]|Microsoft Office|2007|x86|Global

[11]|Microsoft Office|2003|x86|German

[12]|Microsoft Office|2003|x86|English_US

[13]|Microsoft Office|2003|x86|Global

[14]|Microsoft Windows|Server 2003|x64|German

[15]|Microsoft Windows|Server 2003|x64|English_US

[16]|Microsoft Windows|Server 2003|x64|Global

[17]|Microsoft Windows|Server 2003|x86|German

[18]|Microsoft Windows|Server 2003|x86|English_US

When using _ArraySort() I only can select ONE column.

But I would like to sort starting from column 0 to the last column.

Any ideas?

Greet,

-supersonic.

Posted

The function _ArraySort() works so far.

After sorting column 0 I sort column 1. By doing so column 0 gets unsorted.

I looking for a way to fix the sort order of a column.

Not sure whats not working but you can define on which column you want to sort.

Show us the code that doesn't work.

Jos

  • Developers
Posted

The function _ArraySort() works so far.

After sorting column 0 I sort column 1. By doing so column 0 gets unsorted.

I looking for a way to fix the sort order of a column.

Correct, so you do as suggested and add a extra column in which you concatenate the values in the sequence they need to be sorted and sort on that column.

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

Posted

sorry, but i don't get it... :)

can you give me an example, please...?

Correct, so you do as suggested and add a extra column in which you concatenate the values in the sequence they need to be sorted and sort on that column.

Posted (edited)

This maid be a solution but I don't get a clue on it.

When you look at the array I posted above you can see that nearly each line have to be sorted a other way.

If using a static sort schema for each line in the array you mix it up.

Maybe you have example code to understand better...?

Concatenate fields in desired column order to 1-D array (keep delimiter | ), sort 1-D array, split sorted array...

Edited by supersonic
Posted (edited)

It depends on how you want it to be sorted.

Like this:

| |
    \ /
    Col1
    [1] [3] [5] [7]  <=== Row1
    [2] [4] [6] [8]

Or like this:

| |
    \ /
    Col1
    [1] [2] [3] [4]  <=== Row1
    [5] [6] [7] [8]
Edited by Authenticity

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
×
×
  • Create New...