Start over when user reach end of a collection

So I have this collection of movies that is being presented to the user (MoviesListDrama).
Whenever a user has seen a movie, he/she will click on a button (Give me a new movie) and will then be presented with a new movie.

Each movie has an ID attached to it, 1,2,3…

The logic is that whenever the user clicks the “Give me a new movie” button, a click action will update the current user and add the ID of the current movie displayed. The movie ID will be added to a property of the user called “SeenMoviesDrama” to keep track of which movie the user has previously seen.


To be able to show the next movie in the list I’ve added a filter to the list displayed to the user (MoviesListDrama) where it will show the next ID of the previously seen movie. So if the previous movie had ID 7, the filter will show ID8.

The issue I’m trying to solve is that when getting to the end of the collection the filter won’t work as there are no more entries in the collection to show. What I would like to do when this happens is to start over so that if there is no entry, start from 0. I can’t figure out a way to solve this with my current setup so maybe I have to rebuild the whole thing.

But before doing this maybe somene has a clever way of solving this? Maybe it’s possible to evaluate the user’s “SeenMoviesDrama” property and reset it somehow?

Amy ideas would be greatly appreciated!

Here’s one workaround:

  • Have an action on the screen (that’s triggered when the user visits the screen) that only happens when the user has seen all the movies. The action then clears the user’s movies to start it from 0.

I hope that helps.

Hi @Bobzifer ,
I would use 2 collections for this.

The one you have right now:

A. “SeenMoviesDrama”

And another where you keep track of ID of last movie clicked:

B. “Latest Movie ID”

When user clicks “Give me a new movie”, if that current movie ID = MAX(ID), then you add the current record to the “A” collection and in the “B” collection you update the record to the beginning again (ID = 1).

You then use an input field to get that current ID and change the filter to that input field


This way also even if user keeps resetting movies, you will be able to see all his history and the other collection “B” is just to control and recycle the lifecycle of the user.

1 Like

Thanks @JL_LJ

Where and how do I add that if statement/evaluation for checking “if that current movie ID = MAX(ID), then you add the current record to the “A””

I guess in the click action somewhere?

You add it in the “This action will only happen if…”

But this is to trigger only the part that when meets the condition:

“B” collection you update the record to the beginning again (ID = 1).

If not, it just keeps updating the current ID until reaches the MAX ID.

1 Like

Awesome, thanks! Slowly getting there :smiley: Really appreciate the help!

I think i’m doing something wrong because I don’t have any other input value to select than Forgot password.

Anyway, I managed to get the result I was looking for by creating the collection “Latest Movie ID” as you suggested. I then added another “Update Logged In User” action when pressing the button and set it to “0” if the CurrentMoviesListDrama ID = 3 (which is the current maximum ID). So that worked fine.

The downside though is that right now it’s a static number and I want it to be dynamic to avoid having to manually change this number every time I add more movies.
I tried changing it to reset “Latest Movie ID” to “0” whenever the logged in user’s “Latest Movie ID” is equal to “MoviesListDrama” ID Maximum, but that didn’t seem to work. Not sure if I’m using it correctly.

Hi @Bobzifer ,
Let me reproduce this on my side, keep you posted.

Hi @Bobzifer ,
I made a video for you, let me know if clear, my video skills are not sharp lol :smiley:
Create Drip content in Adalo - YouTube


Wow, awesome. Thank you so much!

Just watched the video and I’ll try and reproduce it with how i’ve set up my app having one collection per movie category as I thought it would be messy to have all the movies in one collection.

But the logic should be able to work for that as well i guess.

Will keep you posted! :smiley:

Managed to get it to work now, thank you! :smiley:
I also learned that you can add filters when you add Magic Text - very handy!

Many thanks again for your help!

1 Like

Yep, the magic text with filters makes it very powerful. Glad to hear you made it work, have fun Adaloing :slight_smile:

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.