@ Muneer @Tatiang
I’ve been trying for months to get a stored variable to work for me when restarting a Data Viewer List, to pick up the list where I left off. Finally, Jared has given me this video with this way of doing it in a Data Viewer Grid. And it works as explained. However, I have copied all the blocks and I have changed the names of my variables, and I saved the information while I moved between different pages of the app, that is, while I did not definitively leave the app, but when I did, the stored variable It did not work and when restarting the app, it started as usual from the beginning.
Now, after several days trying, I find myself with an especially singular behavior: So that it does not give me Null or undefined, I have added some function that I already had, specifically “Generate new question and answer”, at the end of its function " setTheScene", and it worked… until it started giving me some results that don’t even correspond to the corresponding row of the database I manage.
I don’t see where you checked for a null value in the stored variable. You have to do that.
The correct way is to say when screen opens, if stored variable = null, set stored variable to [some value]. The starting value could be true or false or “” (empty string) or really… anything. But you have to do that for stored variables to work correctly.
The stored variable will always automatically contain the value that it had when the app was backgrounded/closed/quit.
But stored variables don’t start with a value. They start as null. So you have to check for a null value as shown in the video above. Once you’ve done that, you can set the value to anything you like, such as 1.
Thanks for pointing this out @tatiang! I had no idea that a stored app had to be checked first. I believe this would be the root of all of my crashes. I assumed that the block would initialize it but I am now going through and making sure that all of my stored variables are checked for a null value and then given some value if they are not set.