I'm stuck on sorting listview

To sort a two column table by a single column, you can use a customized copy of this merge sort (all in blocks):

Set the comparison procedure to compare table rows based on whichever column you want to control the sort.