Ordinamento discendente di una listView

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)

image

1 Like

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.

1 Like

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. :upside_down_face:

Don't try to work with the list Elements, use a proper list in a variable.

1 Like

I tried to follow your advice; but I think I didn't understand correctly

Move that last assignment into the local variable scope to clear the error.
7deebd3897f2ac4e8445c62c7fc9cf5c4d06b6a2_2_690x387

:thinking: :thinking: :thinking:

To order the list you can use the following block, there are several examples in this Community.

ordenarlinats

2 Likes

Need an explanation of how to use local variables?

Meet me at the corner of Walk and Don't Walk.

1 Like

:grinning: :grinning: :grinning:

Nicola, non puoi utilizzare concatenati sort e reverse list, prova dividendo in due blocchi

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 :thinking:

lista_ordenada

borrar_orden.aia (2.3 KB)

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 :thinking:

Attach please a small aia with the data and listview

You seem to have ignored this suggestion