I'm stuck on sorting listview

Did you heed my warning?

I saw it, didn't register. Any way around it?

Either:

  1. Sort the original/primary list of songs, before you create any other lists
    or
  2. Make a list of the songs and their indexes before sorting, then sort that list with songs and indexes by song. Then "sort" any other linked lists with the indexes of your sorted list of songs and indexes. Simple :wink:

Something like this:

image

I've lost track of what this is actually about. It really shouldn't be that difficult. I just need to understand what exactly is supposed to happen. So just show a simple example with 3-5 songs and explain the steps in detail.

After the sort the list gets sorted but, the files do not.
sortproblem
If you pick the fifth song on the sorted list it plays whatever was the fifth song on the list before the sort. It's consistent.
For reference aia of what I have
playFromSDcards5_1_3.aia (124.4 KB)

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.

This is because you are setting the listview elements to the sorted list but the selectionIndex is targeting the original unsorted list

Thanks I'm not trying to compare anything, picture was in answer to Anke wanting more info.

I think I misread that. I'm not sure what you want to see. I need the list of files that are in a folder on the external drive to be shown in alphabetical order and be able to click on it to play it. I agree that it shouldn't be that hard.

... Then just have that one List, not two.

I have reworked your aia in order to sort the original list returned from TaifunFile.
Unable to test as no sd card with music files to play with.

playFromSDcards5_1_3_revised.aia (65.8 KB)

Try this one:

Thank you,
After the sort the list is not changed, the songs are are mixed and don't go with the list except for the very top song on the list.
Before the sort all songs will play. After the sort many get this type of error.
webListTooBig2
The list is much longer. On subsequent tries the first line changes to read number (random number larger than 67) of a list of length 67

Found the main issue, needed to reset the titles list. However, the sort will sort by directories the music comes from, then by title.

playFromSDcards5_1_3_revised2.aia (65.9 KB)

You will possibly need to use the approach I showed further up the topic, which sorts the titles (pets) list, then sorts the listPath (petCount) list based upon the sorted titles list.

Yes, that works. I tried manually moving files, adding and deleting files. All work. It does find all mp3 on the drive, not just one folder. Now how do I make it work for me with more editions?

playFromSDcards5_1_3a_revised.aia (102.6 KB)

Thank you, as always, you are most helpful. I'll study this to try to understand what you changed.

But you should add a search feature, because I have by far more than 1000 MP3s on my device:

Good idea. :+1:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.