Forum Academy Marketplace Showcase Pricing Features

Can I sort a list of a data type by the time it was added to the list?

I have a list of bookmarked posts. Post is custom data type.

I want to display and sort the list of bookmarked posts by the order they were saved/bookmarked (i.e. the order they were added to the list) and be able to reverse that sort from descending yes to no.

If I use the Sorted modifier, i get options from the data fields of the posts themselves, so both created date and modified date are not correct.

Is there a way to sort the list itself by its own order. It is almost as if i would need to sort it descending yes/no without selecting a field.

Or is there some other way to do this?

Hi there, @JayM… as far as I know, what you have described is not possible. I could be missing something here, but I think you would have to save bookmarks to a custom data type if you want to be able to sort them.

Best…
Mike

Edit: I should have said what you have described is not possible with vanilla Bubble, and I am definitely a native Bubble or bust Bubbler (hence my suggestion of using a custom data type). That being said, this post might be of interest to you…

@JayM

Add a date field and record the date/time they were added to a list.

You can now sort via this date field.

@cmarchan, I assume you are saying to add a date field to the Post data type, but how would that work when any number of users can bookmark the same post and add it to their own list? What am I missing here?

2 Likes

@mikeloc

You are right! My bad :sweat_smile:

@JayM

As @mikeloc correctly stated it would not be possible to sort the list that way.

Alternatively, if what is needed is to report on activity you may consider creating a log system. What I mean is to create a log object in the dB and add log entries as posts are added to lists by users. You can then count and sort those logs as needed for reporting purposes.

@cmarchan I like this idea in general. Is there a standard or general structure/example you have in mind.

Would it be a data type with something like that? Anything else?

  • Event type
  • Related post
  • By user

I think I remembered that with custom data type vs fields, that I can’t (or don’t know how) to access them when they are nested in another data type or something like that but either I now don’t remember the user case where that was the issue or I have learned how to do it? (maybe it was the fact that I have to create an object using Create New Thing then assign it to the other data type’s field?)

This might be the way to go.

The plugin at the end of that thread looks very interesting for other use cases too. Reverse a List field? - #18 by keith

Yup, that was one of the reasons I linked to that thread. I have never used that plugin, but I know lots of folks do, and I thought you might want to check it out. Best of luck!

Yeah because as I am testing the custom data type setup, I see a bunch of potential issues. Creating an object every time but only removing it from the user if they unbookmark can clog the database with junk, but maybe I do want to keep a record of all the actions taken? if I delete the bookmark data object I lose that, and that goes back to the idea of creating a log.

Just not sure how to structure all this stuff. So many ways to slice it.

@JayM

Log
Type (options set)
User (user)

That is it :+1:t2:

1 Like