Navigation: TextEd > Introduction > Tutorials and misc functions >

Advanced sort

 

 

 

Use the sort dialog to sort a text based on one or several keys. You can use up to 4 keys with individual settings for sort order, string or numeric sort...


 


 


Keys


A key is a piece of text that we use to sort the lines by.


 

E.g. In the text below we have 4 columns of text.
 

Id      Name    Date           Sum
 

054     Paul    2009-05-12     14000.34

014     John    2008-08-24      2300.54

031     John    2008-02-13      3100.17


 

If we want to sort the 3 lines we can choose to sort by the Id, Name, Date or Sum. If we choose to sort by name, we select the 3 lines and use the values


 

[Key 1]

Ascending sort

Start Column: 7

End Column:  11
 

Since we have 2 John's we could use a second key to sort these two. If we sort by Sum, add on the Key 2 tab:
 

[Key 2]

Descending sort

Start Column: 31

End Column:   39


 

The result should be:
 

Id      Name    Date           Sum
 

031     John    2008-02-13      3100.17

014     John    2008-08-24      2300.54

054     Paul    2009-05-12     14000.34


 

The lines are sorted by name in ascending order. The two John's are sorted by the sum values in descending order.
 

Sort order


Two values are available. Ascending and descending sort order. The default sort type is strings. For numeric sort check the option below.

 


Columns


To select a key we must enter a range of characters. The start column is the first character position of the key text. The end column is the last character in the key text.

 

Ignore case


Ignore the case of the keys. E.g. John and john are treated as equal if case is ignored.

 


Numeric sort


The key text should be treated as numeric values and be sorted in correct numerical order.

 


Remove duplicate keys


In the example above, the first line "031  John..." would be removed with this option checked, since we have a duplicate key value "John". The entire line will be removed as can be seen below.

 

The result:
 

Id      Name    Date           Sum
 

014     John    2008-08-24      2300.54

054     Paul    2009-05-12     14000.34

 


Use this to remove lines where we have duplicate key values.

 


Remove duplicate lines


The entire lines are compared and duplicates are removed.


 

E.g. if we have


 

Id      Name    Date           Sum
 

014     John    2008-08-24      2300.54

014     John    2008-08-24      2300.54

054     Paul    2009-05-12     14000.34


 

we can use this option to remove duplicate lines. The result would be


 

Id      Name    Date           Sum
 

014     John    2008-08-24      2300.54

054     Paul    2009-05-12     14000.34

 

 

 

 





 

 

 

 

Copyright © 2022 Rickard Johansson