Sort table of table by two columns

Hi, I'm trying to sort list of list from a CSV table of best scores in AppInventor.
The first column contains the nickname of the player, the second their personal highscore and the third the date of this personal highscore.
What I'd like is to have an descending order of the highscore and, when the high scors of to different players are equal then put them in ascending order.

I've been able to sort by the high scores with this blocks:

But I don't know how to use also the dates.
Could you help me? Thanks in advance!

Show your data.

You dates will probably need to be in an alpha-numeric text format to be sortable, e.g. 2024-08-24-11-26

They already are, here some exemple data.
immagine

What I really don't get is how to ask to sort by to different columns.

I believe this is what you need. The reverse blocks places the highest score to the top.

ref

It seems it is not working for me.
Trying to implement your solution, only the "reverese list" block works, while there is nosorting by score neither by date.
I've trided to sort one at a time by score and by date and they works, so I think the problem might be with the "or" block. Any suggestion?
Here the blocks and the results:


Yes, I tried your data, and it won't come out right. Still looking at it.

1 Like

Try this ?

2 Likes

Thank you very much! That resolved the issue.

I've found a shorter version of your code:

There is a text fly in your numeric ointment.

Column 2 is a number, so you have to use numeric compare operations on it, not text compares.

Otherwise you would get results like '100' < '50'.

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