Sorting a list in descending order

I’m making an app for my school and I’m fetching addresses from airtable (many of them are repeated) to a list. Then I create two lists one for unique addresses and one list that calculates how many times an address is present. Finally I join this two to one new list . My problem is that I want this final list to be sorted according to the total number that an address is seen in descending order, any help appreciated

Here are my blocks and how it looks in listview

1 Like

create that list of lists like this
address1,5
address2,3
address3,1
then use the webviewer together with some JavaScript to sort it, see also https://groups.google.com/d/msg/mitappinventortest/pVA3VUMN5W8/pZLttKYl3-8J
then do the formatting of the result list

Kodular’s webviewer also offers the EvaluateJS method, which makes this solution even easier… see also


Taifun

2 Likes

Thank you so much , I will try it and post my results

Yes, you can sort a table, the issue is that sorting is, in itself, not a trivial task.
While you can sort with whatever method you want if the list is short, then it gets progressively prohibitive if the list is large.
How many entries do you expect to have? If you remain at less than 100, you are OK. If you expect 500+, the sorting can take up to 5 seconds; and if you have 1000, over 20 seconds.
Speeding up this will require passing the sorting activity to a HTML/JavaScript file called by a webviewer component (a JavaScript program will run about 700 times faster than one made with Kodular block components).

At this point I’m expecting to have from 100 to 500 entries max since it is a school project .

Maybe you could use this:

2 Likes

First of all I want to thank you all for your replies. I tried @Taifun 's proposal but I couldn’t make it work cause I’m still learning the use of lists. If I create my lists like in the picture below, it works but unfortunately I couldn’t find the way how to proceed with my list and how to create a list of lists

Then I tried @ONikosEimai 's solution which didn’t work for me . But based on his idea to put first the number of the accidents and then the address like in the following example example “6 total at Grigoriou Kidonion 28, Kalamaria 551 31, Greece” I realized that I could use ListUtils extension from AppyBuilder to sort my list in descending order and it works perfectly

Thank you all for your help, really appreciated

4 Likes

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

Taifun

1 Like

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