Sort RG by Last Opened or Last Viewed

Imagine a CRM type app. I want my users to see a list of the 10 most recent records they visited, for each Thing.

I can obviously sort by Created or Modified, but I want ‘Opened’ or ‘Viewed’.

Does this mean I have to create a new datatype and then create a record every time a page is loaded, for each of my Things? Is that the only way to feed this back in an RG?

Hi there, @martin10… since the lists will be small (only 10 items each), you could consider having list fields on the User data type, and when a thing is viewed, add the thing to the appropriate list (and likely remove a thing, too, when the list’s count is 11 after the viewed thing is added).

Now, one might argue that this suggestion isn’t much better than creating a new data type, but it feels “lighter” to me (or maybe less “heavy-handed”) than having a separate data type. So, if it was me, I would likely go the list route.

Anyway, just food for thought there, and I hope it helps.


Cheers Mike. So it is something I have to build in myself, I’m not missing something obvious? So with your suggestion each User will see their own most recents - nice. So I do have to trigger a workflow everytime a page is loaded, right?

And each User will need a ‘Recently Viewed’ field for each of my Things, right? Can’t just use 1 field on the User to track all recents, that won’t work will it?

To the best of my knowledge, you aren’t missing anything obvious, so yes, you have to build something yourself.

Yes again. You could use a backend workflow, though, if you are concerned about a performance impact.

And yes one more time. You would need a separate list field tied to each one of the things a user can view.

Ah, only thing there is that the resulting list will not be in order of ‘viewed date/time’ coz I don’t have a record of the time the User field was changed. I could display that list of 10, by Modfied date maybe… But if I went the bulky route and a new datatype I could get a list of say 20, all in most recently viewed order…?

The list of things will be in the order you added them in. So the last item will be the last one added.

Ah lovely, nice one, thx guys.

1 Like

Hmm, indeed that list is in order. But the last/most recent is at the bottom of the list rather than the top. Unless I’ve missed a trick with this method I might have to go a different route…?

Yeah, you would have to use a plugin (list shifter) to sort those lists or you might have to go the custom data route if you want even more flexibility.

The ListShifter plugin can reverse lists so maybe try that. I believe you drop the element on the page, give it your current repeating group’s data source. Then change your repeating groups source to the ListShifter’s shifted list. Then on the element change “Reverse list” to yes

So it does, how clever. Function solved :slight_smile: Good night all/.

1 Like

Or use Floppy… you can insert items anywhere in Floppy’s RAM List. (You could also not even store that list in the database but just keep it in localstorage or indexeddb, using Floppy.)

If using vanilla Bubble plus List Shifter, I’d just reverse the list. (Aside: One should be able to insert an item at the first index of a list in vanilla Bubble [by setting the value of some_list to some_single_item:converted to list :add list some_list… which would just concatenate our one item list with all of the current list values], but for some reason, “add list” is not an option in that scenario, even though “minus list” is. I assume this is a bug and I can’t really be bothered to tell Bubble about it. :wink:

1 Like

Can’t believe I have to tell the list shifting god himself that the :plus list equivalent is merged with :wink:

@martin10 Keith is right though you could do it with vanilla Bubble using his described method.

1 Like

Oh, wait… with the merged with operator, I think you could totally hack this one with vanilla Bubble.

When a thing is viewed, move the existing things in the list (minus one thing if the list already has 10 things in it) to a custom state. Then, set the list to the viewed thing converted to a list. Finally, merge that “list” with the list in the custom state, and, uh, profit!

There, I win for lamest suggestion ever. Oh, and don’t worry @keith… I haven’t forgotten about Floppy already, but we can’t just be kickin’ List Shifter to the curb like that, now can we?


My point was that “plus list” simply does not appear as an option in that scenario (go try it, it just doesn’t appear) though it could be that “merged with” does. (And you’re correct, I hadn’t thought of that alternative, @tylerboodman!)

1 Like

List Shifter and Floppy do some of the same things, but via completely different APIs (if you will). The interface to List Shifter is a little bit obtuse (partly because it really evolved over time and features just got grafted on as I thought of them). It’s still like, one of the best things anybody ever built for Bubble and that’s why it’s shareware. (Also, it wasn’t designed specifically for random access to list values [which you can do in Process List, but is cumbersome].) Blah, blah, blah, but I think you’ll be interested in my next video on Floppy which gets to that exact topic.

1 Like

Movie night with my girlfriend is now exclusively Floppy videos. She threatened to leave me… I said I’d help her pack.


This topic was automatically closed after 70 days. New replies are no longer allowed.