Sort values inside the in-app filter

Hello Gliders !

I have a questions regarding the in-app filters :slight_smile:
I have a table called “Client folders”. For the context, the table is designed to store links of all the invoices to be sent to a specific client for a specific time period.

So for example we could have a Client folder A for a Client A and a Time period of March 2023…

The table includes 2 specific columns “Year” and “Month” which contain the time period information. On the top of this field I created a template column “Time period” to get the time period in the following formt 03/2023 instead of March 2023.
I use this template column within the in-app filter in order to let the users filter Client folders based on a specific time period.

Unfortunately, no matter what I try, the values displayed in the in-app filter are always sorted in the alphabetical order where I would like to have them in the opposite order.

Would anyone have a workaround to make this work ?

PS : I use Airtable as a backend where I created the fields “Year” and “Month”. The computed column “Time period” is obviously only in Glide

What do you consider the opposite of alphabetical order?

First of all, the result of a template column is a text string, so sorting will be alphabetically. That is different from numeric sorting or date sorting.

Since your value is a text string, it would help to understand how it’s sorting now, and what you are expecting to see. I guess if I were to sort by a date, I’d either have a date column, or in your case, I would change to template to be YYYYMM instead of MM/YYYY, since numerically or alphabetically, it will sort the same.

2 Likes

Hi Jeff,

You’re right, I actually made a mistake when writing my question, I’m using the format YYYYMM not MMYYYY.
Currently my filter values are filtered this way 202210, 202211, 202212, 202301,202302
I would like to have instead 202302, 202301, 202212, 202211, 202210…

I’ll take a look shortly to confirm, but I’m not sure if you can change the sorting to descending order in the in-app filter.

I tried using the Chat GPT function on the documentation page, but I really don’t understand the explanations.
Here is what it says :

To sort the values displayed in the in-app filter component, you need to create a computed column in your Glide Table that references the field you want to sort by. Once you have created the computed column, you can sort it in ascending or descending order.

Here’s a link to Glide’s documentation on computed columns: https://www.glideapps.com/docs/reference/data-editor/computed-columns

Once you have created the computed column and sorted it, you can use it as the data source for the in-app filter component. The in-app filter component will automatically display the sorted values.

Here’s a link to Glide’s documentation on sorting with computed columns: https://www.glideapps.com/docs/how-to/sort-a-list-using-a-computed-column

I hope this helps! Let me know if you have any other questions.

And when I ask more explanations…

You can use a computed column to sort the values displayed in the in-app filter component.

Here’s an example of how to sort a list of items by a specific column using a computed column:

  1. In the Data Editor, create a new computed column by clicking the “Add Column” button and selecting “Computed Column”.
  2. Give the computed column a name, such as “Sorted Items”.
  3. In the formula or script editor, write a formula or script that sorts the items by the column you want to sort by. For example, if you want to sort the items by their price, you could use the following formula:=sortby(Items, Price)This formula sorts the “Items” array by the “Price” column.
  4. Save the computed column.
  5. Use the “Sorted Items” computed column as the data source for the in-app filter component.
  6. The in-app filter component will now display the sorted items.

Take the answers from a robot with a grain of salt. It can make words sound good, but it doesn’t necessarily mean they are correct.

Yep I can see that :joy:

1 Like

I mean, to some degree it is correct. If you can use computed columns to come up with a value that would sort alphabetically the way you want, then it would work.

For example,this would sort the way you want, but it’s a matter of getting the correct letter in front of the correct date…and is that what you really want.

A202302, B202301, C202212, D202211, E202210

That’s a good point but I’m not sure this would be a scalable solution for me. Also, it might look confusing for the users.
That’s too bad that we don’t have a way to sort the values natively !

Anyway, thanks for your help on this @Jeff_Hager :heart:

1 Like

I finally took a closer look and from what I can tell, there is no way to change the sorting of the in-app filter. It will sort properly based on the data type, but it will always be in ascending order. I don’t think there is any way around it.

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