Help with creating a "recently viewed" repeating group

Hello fellow Bubbler’s! :wave:

I am hoping to get some help with finishing off a new feature on my app. The app is a database for recruiters to store their candidates in and the feature is a repeating group which will show the user a list of their 10 most recently viewed candidates.

So far here is what I have done:

  • created a “recently viewed candidates” field under the User data type
  • created a workflow trigger when clicking to view a candidate which adds the candidate to the User’s recently viewed candidate list

This is working and the repeating group shows 10 viewed candidates like it should but my sticking point is those 10 candidates aren’t updating when new candidates are viewed.

The most recently viewed candidate should take line 1 in the RG, shifting the rest down and removing the candidate who gets shifted to 11th spot from the list completely.

Has anyone got a solution for this?

Thanks!

Hi there, @mattwatts29… you are adding a candidate to the user’s list when the user views the candidate, but are you also removing the oldest candidate from the list as part of the workflow? You didn’t mention anything about removing a candidate from the list, so if I understand your post correctly, it could be as simple as adding that to the workflow.

Best…
Mike

Hey @mikeloc , thanks a lot for this. You are right, I didn’t have a remove candidate from the list in the work flow :man_facepalming:. Thanks!

Now, in the workflow step where I am adding the new candidate to the list, I have added another field which is removing candidate #11 from the list. Does this sound correct to you?

Another problem I am facing is having the repeating group display the list of 10 in the right order as per most recent to least recent. When I click on a candidate they go in to the list but not to the top. Any thoughts?

Bubble offers the sort by “modified date” as an option but this isn’t solving it. I feel like there is likely a creative workaround to this.

Thanks for your help :slight_smile:

Yes, that sounds correct. About reversing the sort order of a list field, well, that’s not quite so easy. Here’s a thread you can check out, and you should definitely check out the plugin at the end of the thread.

Thanks for this @mikeloc. What’s handy about this is I actually had a list shifter being the data source of the RG already! Have never tried the reverse list before but it has worked and the most recent candidate now appears at the top.

Thanks so much for your help on this!

1 Like

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