- AuthorPosts
- October 10, 2022 at 12:26 pm #28693spirosParticipant
This can be an extra option in the Sort options, implemented in the following ways:
1. On row level (as separated by columns)
2. On delimiter level. Could be a selection box and an option for custom delimiter (supporting multi-character delimiters), I.e. [space][comma]How does it work? See here https://chandoo.org/wp/howto-sort-left-to-right-in-excel/ (columns only)
October 11, 2022 at 2:38 am #28694DavidParticipantThere’re different way for sorting column, such as A-Z, Z-A, 0-9, shortest – longest……
If having sorting row feature, wish to have same options.October 12, 2022 at 9:43 am #28723Yutaka EmuraKeymasterThis macro will sort (A to Z, case insensitive) by row level at the current cursor (or selected cell) line. You can use this macro to develop further for different sort criteria.
function SortOneColumn( yLine ) { count = document.GetColumns(); arr = new Array(count); for( i = 0; i < count; ++i ) { s = document.GetCell( yLine, i + 1, eeCellIncludeNone ); arr[i] = { name: s, col: i }; } arr.sort( function( a, b ) { var nameA = a.name.toLowerCase(); var nameB = b.name.toLowerCase(); if( nameA < nameB ) { return -1; } if( nameA > nameB ) { return 1; } return 0; }); bSorted = false; for( i = 0; i < count; ++i ) { if( arr[i].col != i ) { document.MoveColumn( arr[i].col + 1, arr[i].col + 1, i + 1 ); bSorted = true; break; } } return bSorted; } yLine = document.selection.GetActivePointY( eePosLogical ); while( SortOneColumn( yLine ) );
I am not sure what you mean by 1. On delimiter level.
October 12, 2022 at 10:14 am #28724spirosParticipantImagine Excel, I mean being able to sort multiple entries left to right in one cell, separated by a delimiter, I.e. comma.
And this procedure to the totality of selected rows.October 12, 2022 at 10:48 am #28725Yutaka EmuraKeymasterI am still not sure if I understand your question, but if you are talking about a nested CSV like this page:
https://www.emeditor.com/text-editor-features/more-features/nested-csv/and if you would like to sort, for instance, “apple;banana;cherry“, you can select “Split Columns” while selecting the second column, select (None), enter the separator (a semicolon in this case), set the Sort split strings option, and select a desired sort criterion.
October 12, 2022 at 11:07 am #28726spirosParticipantI tried the way you described, did not work as expected, created columns instead.
I mean like having multiple lines like these:
stuff, apple, banana, cherry, all sort, more, mpme, stuff, apple, banana, cherry, all
Then simply running horizontal sort, and the end results being with A-Z sort
all, apple, banana, cherry, stuff all, apple, banana, cherry, more, mpme, sort, stuff
Of course it would be good if one could define the delimiter in the process.
October 12, 2022 at 11:42 am #28727Yutaka EmuraKeymasterOK. I now understand your question.
Currently, you can select a CSV mode (for instance Tab-separated, NOT Comma-separated) so that only one column should exist. Select the only one column, select the Split Columns command, then select (None), enter the Separator (Comma + Space in this case), set the Sort split strings option, and select a desired sort criterion.
Alternatively, you can split to multiple lines by replacing Comma + Space with a newline, sort, and then replace a newline with Comma + Space to restore newlines.
I will think about a new command in the future.
October 13, 2022 at 3:33 am #28742spirosParticipantHere is an Excel implementation (so you understand better what I mean by cell-level)
https://www.asap-utilities.com/asap-utilities-excel-tools-tip.php?tip=278&utilities=42&lang=en_usNovember 8, 2022 at 3:19 pm #28925Yutaka EmuraKeymasterWe’ve just released v22.0.901.
– Added the Sort/Remove Duplicate split strings in Selection, Sort Columns, and Manage Columns command.
- AuthorPosts
- You must be logged in to reply to this topic.