How to save list in the app

I have an application that pulls a list from google sheet, Recycler list + Json template

but whenever the app starts, the list is loaded, as I already leave this list saved in the app.

Hi Lxp,

Welcome to the :kodular:odular community!!!

If I understood correctly, you’d like to save this list in the app and reuse it when the app is reopened.
The simplest thing you can do is save the list in TinyDB using the StoreValue function, and when the app opens, check if the tag is present, if not, download it.

This way? I don’t think it worked

blocks

You were close but you have to save the list in the StoreValue not the length :grin: , then when the screen initializes if lista is in list of getTags then create Template with storedList

blocks

Sorry Ibrahim, but I need to correct you, this can’t work.
The get value would return a list, and checking if it equals to SavedList would always return false.

If you want to make it even better, you can create a procedure that builds the template so you can use it both after the Web.Get and in the Screen.Initialize.

and what would the storage block look like?

What do you mean?

Is this the right way?

Move the StoreValue form procedure to Web.GotText so that you save the values only when you receive data from Web and not every time you call the function

This way, I understood how the “response content” comes into play to call the files.

You store the responseContent once when you get it from Web.GotText.
After that, you don’t need to fetch the data again, you just use the stored one.

I don’t think I explained it correctly, the procedure you sent is not on the web, how does the procedure pull the responsecontent, Does this procedure go into web1?

If you want to create again you’re layout call the procedure anywhere you to want to use it. Also don’t use length of list block, use only respondContent when storing the data, check my first reply

The procedure I sent you at the first access downloads the list from Google Sheets and saves it in TinyDB, at the second access, if the list is already present, it uses the saved one, otherwise it downloads it.

ok, thank you, you and Ibrahim helped me a lot

:sweat_smile::sweat_smile::sweat_smile::sweat_smile::sweat_smile:

That’s why its community

Welcome


this way works, or you need to recreate the template

1 Like