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?
Hi @Bobzifer ,
I would use 2 collections for this.
The one you have right now:
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.
Awesome, thanks! Slowly getting there 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.