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?
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.
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.
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.
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.