Filter and Sort

Haha no worries! :grinning:

Instead of typing it, can you try selecting the “sort” function here:

yeah, i know it, i tryed to do like your example, but the result didnot change(
there may be a problem in my data or I am adding information to the table incorrectly.

Ok, it seems you don’t have a column with “Name” in your table.

Can you try adding “Last Name” as an argument instead of “Name”?

Now varriable is working, but the data in the table doesnot refresh at all.
It doesnot refresh when I’m trying to do this step (1.a.) As i understand, it should be refreshed in real time, but the data disappears(
P.s. sorry for my language :sweat_smile:

Did you select the “Data” button in the formula? (it needs to have the real list of objects)

Yers, i did.

Hi Nick :wave:

Would you mind sharing a link to the editor so we can take a hands on look for you?

It might be easier than asking you for screenshots :grinning:

Don’t hesitate to DM the link if you don’t want to share your project in the forum.

This is my projekt

Hi Nick!

Just had a look at your project and created a Google Sheet test page (a duplicate of your Google Sheet page) to try out the formula.

It’s working fine now. Here the formula you can copy in your Google Sheet page to make it work:

Feel free to delete the test page! I just left it there so you can see it’s working and because I didn’t want to mess with your original page :slight_smile:

A couple of things you might find helpful:

  • the formula is at the “Collection List level” because you want to sort items in that list
  • when you hover on a formula name, a short explanation of how the formula works pops up

In the case of this sort formula, you can see:

  • the first argument is the data from your collection, i.e. Example[‘data’]
  • the second argument is how you want to order your sort, ascending or descending. In a previous step, you defined a sort variable so you want to add that variable as the “order” argument, in this case, we had called it sortByLastName
  • the third argument is the name of the field you’re sorting in your collection, in this case, the column name is “Last Name”

Does it make more sense now?

It works)
But what if i wanna add sort to other columns?
I tried to do the same things (add workflow to other icon and complement the formula), but nothing happens with new sort and also the old one was broken.

Ah ok, got it!

In this case, you’ll need 2 variables:

  1. one to change the sort from ascending to descending alphabetical order every time the user clicks on the sort icon
  2. one to change the name of the field you’re sorting through depending on which sort icon the user clicked on

In your project, I’ve named these variables:

  1. sortOrder
  2. filterName

Both are string variables that are empty by default.

Since you have 2 variables you want to change when the user clicks on each sort icon, you’ll need 2 actions in the workflows that trigger when the user clicks on a sort icon:

  1. the first action will change the filterName variable to match the field in your database that you want to filter

  2. the second action will change the sortOrder variable each time the user clicks

In the screenshots, we’ve done this for the sort icon related to the “First Name” field. You would need to repeat the same action on each sort icon. The only thing that would change is the text you put in the first action.

Finally, you would change the formula on the Collection List:

  • the array is still the collection data
  • we want to sort it in ascending or descending order (changes every time the user clicks on the icon)
  • by the field defined in the filterName variable (changes based on which icon the user clicks on)

If you’d like to check it out, I’ve set it up in the test page of your project :slight_smile:

Oh my God, thx so much. It is exactly what i’m looking for.
I’m trying to understand how to filter in real time? I know that it can be from Collections…(img.)
image

But what if i wanna do the Filter in real time?
For example - I wanna to filter my data by name or company name.

1 Like

image
Like this.
P.s. it is my “project”

1 Like

Great question!

The easiest way to do that is with a dropdown select menu element. We’ve taken it out of the toolkit for now because it had performance issues but it should be fixed and live again in the next few days.

Would it be ok for you if I sent you a tutorial towards the end of this week or early next week?

It sounds perfect) will there be a detailed guide ? :sweat_smile:

1 Like

Yep, I think I’ll create a dedicated tutorial/detailed guide like this one so everyone can follow along from start to finish :slight_smile:

@Joyce and @flo I’m having trouble with sorting using no-code frontend filters. What is the correct value to bind to “order”?

I tried “Desc”, “desc”, “descending” etc with and without quotes, but not seeing a change. It does work if I select the desc option from the dropdown. Thank you

1 Like

Hi @foliodc you can try DESC, it should work :slight_smile:

2 Likes

That worked thanks! I’m a little confused by the sort direction. Alphabetical works A to Z for ascending, but numbers seem to be backwards. Ex, when I set to “ascending” it starts with the higher number (timestamp in the future) and goes down (timestamp in past). And when “descending” it shows the opposite (older/lower to newer/future/higher). Not so bad bc I can bind to get the right answer, but my site will be backwards if this changes in the future, maybe I’m misunderstanding something. Thanks!

3 Likes

@foliodc I’ll check that, because it also seemed to me that our Asc/Desc was inverted on some data types.

I didn’t remember which ones when building, thank you for reminding me :laughing:

I’ll check and add the bug fix in the roadmap if needed.

EDIT: indeed it’s inverted on numbers, I added it as a bug report for the tech team :wink:

1 Like