Hello everyone,
basically I want to sort a numeric ListView in descending order; but I think this is not the right way
Greetings
Nicola
Try this (blocks should be draggable, click on blocks image first)
and using @Kevinkun 's solution (see below)
You used COMPARE TEXT, which has '10' < '9' .
You want Compare Numeric.
Your blocks work perfectly (as they always do); but I add numbers manually in the ListView and not through a local variable.
use Web.DecodeJsonText('[4,8,3,9,5]'), you can change a string to a list of numbers.
Inside the numbers local variable, I tried to replace the string of numbers to sort; with the ListView.Elements..believing that the same procedure could also order the elements of the ListView; but I was wrong.
Don't try to work with the list Elements, use a proper list in a variable.
Move that last assignment into the local variable scope to clear the error.
To order the list you can use the following block, there are several examples in this Community.
Need an explanation of how to use local variables?
Meet me at the corner of Walk and Don't Walk.
Thanks for your advice; but in the end instead of sorting the list with a specified comparator; I chose to sort the list by key, in ascending order.
Greetings
Nicola
@Juan_Antonio Crazy..I was about to make the APK..so I did the last checks; and I realize that sorting ascending doesn't work anymore
This example is similar to the one @TIMAI2 pointed me to; only in my case, the numbers to be sorted are present in a ListView. P.s: I don't understand why sorting via a key doesn't work anymore
Attach please a small aia with the data and listview
You seem to have ignored this suggestion