How to sort API results generated in a repeating group?!

Hey all - please forgive me for the basic question, I am new to Bubble :slight_smile:

I have created a repeating group that displays the API results from a custom google search, however, I am having trouble allowing the user to sort these results using a “dropdown” input. I would like the user to be able to sort the results either alphabetically or chronologically.

Any help would be greatly appreciated!

You need to use :sorted function. This work like when you use Do a Search and sort the result.

Do I include the :sorted function in my repeating group or within the dropdown function?

in your RG group. The sort will use the value of your dropdown if you need.
It’s not always easy however depending of the API payload. But most of the time it’s the way to use.

This is how I have the RG :sorted function currently set up, however, it is still not triggering anything when I change the dropdown.

It’s not always easy with API connector because you need to use the exact field name with the dropdown. In some case, it’s easier to use the conditionnal and change the sorted according to the option selected in the dropdown instead of dynamic value. But it can lead to a lot of data to load.

Thank you!

1 Like