Local db data not persistent

Hello everyone. Hope someone can steer me in the right direction. I have an app that scans a barcode and retrieves the barcode information from an API (in this case an ISBN from a book). I display the book’s information and give the user the option of saving the book to a local db table. Later on, the user can open a list of books that he or she has saved. This data should be persistent, and should not disappear when the app has been closed and then reopened. Everything is working except the data is not persistent and disappears if I close the app and reopen it. Here are my blocks:

What am I doing wrong?

Thanks for the help!

Doug

Hello,

Store data locally between sessions can only stored variables and component Local Storage.

2 Likes

Hi Doug! :wave:

I recommend you to choose local_storage instead of localDB.
LocalDB works for the current current session of your App.

Thanks! :blush:

3 Likes

Thanks, I’ll give that a try!

I’ll be using the ISBN of each book as a key and the title as the value. How would I retrieve the data for the list viewer? What I would like to do is something like my original blocks, looping through all the data and populating the list that way. How would you do that without specifically knowing the key?

Thanks for your help!

All right, so here is my simple work around.

I just use a stored list. Not sure why I didn’t think of this before. The data is persistent. Not sure what the size limit on the list might be…I’ll let you know if I reach it.

Doug

1 Like

That sounds unusual @DouglasRussell

Can you tell us a bit more about the conditions so we can try recreate this error on our end?

i.e: Live Testing or installing your app?
Android and/or iOS?

Thanks.

Sure thing. In live testing (latest Android version), everything works fairly well using the AddRow block in the Local_DB. Data gets stored, and is retrievable. When I exit live and then come back, the data is gone. I thought maybe this was just a “live thing”, so I downloaded my app and tested it, same issue. I haven’t test it on iOS yet.

Doug