Sorting Data viewer list

I was looking for a way to sort the data in Data viewer lists to display it sorted Ascending
I used the following, to solve it.

image

is there any other way to sort the data…?

1 Like

This is a much quicker option.
image

Once you get the values in the list, sort the list using this block.

Thank you, Muneer…I used it in my coding…and to be honest, I got the idea from your post… :pray: :clap: :clap:

1 Like

1 Like

Hi,
I have read the various topics about sorting. The content of my Data List Viewer is based on an Airtable.
In my app, the users should be able to change the sorting themselves (alphabetical or price).
How to solve this in the easiest way?
Isn’t there an easier way than building these “parallel” lists?
Thanks.

when you use the airtable api and the api blocks, you can set your data to be sorted by a particular column. If you are using data blocks to get your data instead, you’ll need to manually code your your sorting logic.

Thanks, jared

I’m using the Airtable API, and the default sorting (A…Z) is based on a specific column. It works fine. But when the user press a specific button, the sorting must be changed to Z…A.
How can it be done in the most simple way?

I would probably just make another Airtable API call with the column as a sort key. You can do that with filterByFormula (which you can find on these forums or by Googling if you’re not familiar).

How to convert a Data viewer list to a list that then can be sorted with the code sample by muneer ?

To sort a Data Viewer List (DVL), sort the database itself. To get the DVL data as a list, use the list of values block. But if you sort that list in Thunkable, it won’t change the way the DVL is displayed. You still have to sort the original data. If you want a list that can be sorted and displayed in Thunkable, you’ll need to use a Simple List (aka List Viewer).