supersonic Posted January 25, 2009 Share Posted January 25, 2009 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. Link to comment Share on other sites More sharing options...
Developers Jos Posted January 25, 2009 Developers Share Posted January 25, 2009 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 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 More sharing options...
KaFu Posted January 25, 2009 Share Posted January 25, 2009 Concatenate fields in desired column order to 1-D array (keep delimiter | ), sort 1-D array, split sorted array... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
supersonic Posted January 25, 2009 Author Share Posted January 25, 2009 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 Link to comment Share on other sites More sharing options...
Developers Jos Posted January 25, 2009 Developers Share Posted January 25, 2009 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. Link to comment Share on other sites More sharing options...
supersonic Posted January 25, 2009 Author Share Posted January 25, 2009 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. Link to comment Share on other sites More sharing options...
Developers Jos Posted January 25, 2009 Developers Share Posted January 25, 2009 Sure, http://www.autoitscript.com/forum/index.ph...&pid=110754 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 More sharing options...
supersonic Posted January 26, 2009 Author Share Posted January 26, 2009 (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 January 26, 2009 by supersonic Link to comment Share on other sites More sharing options...
Authenticity Posted January 26, 2009 Share Posted January 26, 2009 (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 January 26, 2009 by Authenticity Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now