[RESOLVED] Can You Sort Table View Cells GET'ing Bubble Things by Created Date?


#1

Hi there.

So I created a Table View with a Table View Cell that is GET’ing Transaction Thing information from Bubble API to display in each cell.

Right now the cells appear to be displaying oldest Transactions first, but I would like to display the data in the Table View so that the newest Transactions are displayed first in the Cells. How do I achieve this descending order?

At first I thought it might have something to do with binding the Sort Field Parameter with the Table View, which I thought might open up additional options but it is displaying this error.

Then I tried investigating whether there is an ability to bind the GET Response “Created Date” which opens up sorting options, but that doesn’t appear to be the case.

I found the Filter API Array Values help article on DS, but it doesn’t appear to answer my question as I’m not comparing one input against another (unless I’m misunderstanding).

Has anyone achieved an ability to sort by Creation Date, or by any other value (like alphabetical)? Or know how to do it?


#2

In the API Parameters tab, select Query, then you will a sort_field and descending field.
Bind the sort_field to a static input and enter the name of field you want to sort by.
You can use the descending field to specify whether descending (static input true) or ascending (static input false)


#3

@seanhoots you are the man. Thank you!

For those wondering step by step, here goes:

Step 1
API > PARAMETERS > QUERY

Step 2
Click into the SORT_FIELD parameter and “bind” it to the category you want to sort by. In this case you will need to know the name of the Field Type in your Bubble Thing. For instance for me, I wanted to sort by “Created Date”, so I needed to select STATIC INPUTS > STRING… then write out “Created Date” (or the Field Type you are sorting by).

Step 3
If you want to finalize sorting by descending, click into
DESCENDING > STATIC INPUT > BOOL (yes/no) > Select True (yes) if you want to sort descending.

That’s it. Goodluck to all.

EDITED to correct mistake in step 2 pointed out by @Ideas12 below


#4

I believe in step 2 should say:

“Click into the SORT_FIELD parameter…” and not as quoted below.

Please correct me if I am wrong…

Thanks,
Rick
Freelance developer


#5

@Ideas12, you are correct!

Nice catch, and my bad. I think because the selection screen blocked the sort SORT_FIELD, I just read off what I could see which was the selected DESCENDING parameter. That’s what I get for writing this up after a 12 hour workday.

Let me edit that now so others aren’t confused.


#6

Thank you guys!!! @marktuff @Ideas12 @seanhoots