Best practice question of lists.
i want to create items to a list. The list should be consistant in new sessions (when i reopen the app “tomorrow” )
How do i do that? The app variable disappears over each session as it seems and is probably correct.
However, using “Store” is not good as i cannot tell the variable to be a list (Make a list block cannot be attached.
Cloud is not an option as it loses connection with both airtable, google sheets and the “own created table” So, can you give example of adding items to a list which is then stored i the app over sessions.
Thanks
App variables do not save values once the app is closed. You could use a cloud variable to store a list because Firebase data is cloud-based and therefore available even after an app is closed. But generally a stored variable is the best option for this.
Here’s a project that demonstrates this: Thunkable
I see what you mean thanks - One questions though
IF i want to use Store (not Cloud)
How shall i let the STORE variable understand there is a LIST to Store?
I cant create as “make a list” can I?
I know it’s confusing that you can’t initialize a stored variable with a variable type (list, text, integer, etc.). But you can still set the value of a stored variable. The first time you set the value, it will also set the type. So if you assign a list block to a stored variable then that stored variable is a list variable.
These blocks force the stored variable myList to be a list variable and allow you to then use list blocks with that variable:
It’s important to check for a null value when the screen opens because a stored variable will always be null the first time the app launches.
By the way, the make list from text block isn’t really needed here. I just wanted a quick way to pick a random word from a list so I used it. I rarely use that block when working with lists.
This image show it works and the first item is added at last in list (Position 1)
When do ytthe next registration - expected behavior would be to place next one in Position two as i use “At Last” in list…
However number one keeps being overwritten
Any idea on that one…
(I did a check with how long is the list and it keeps stating “1”)
I can’t tell why that would happen from the partial screenshot you posted. It depends on the event you’re using (when screen opens, when button click, etc.) and on other blocks that might be there but aren’t visible.
I can tell you that the check for = null with a stored variable is only needed and will only be true when the app opens for the very first time. That’s where I set the initial value (e.g. empty list) for the variable. After that, it won’t ever happen again.
But to your question, yes, if you insert an item at “last” in a list and then insert it at “last” again in the same list, those values should follow each other as they do in the demo I provided with the first value inserted followed by the second value.