Skip to first unread message

Nick Schmidt

unread,
Mar 2, 2016, 5:19:35 PM3/2/16
to MIT App Inventor Forum
I have an app that needs to use two TinyDB.  The reason I need two is because at a point in the app,  I use the "call TinyDB1 clear all' block to clear some values that need to be reset.  I also need another TinyDB to store values that I don't want to be cleared.  I have noticed that when I clear TinyDB1 it also clears the TinyDB2.  I took a look in the root/data/data partition and I noticed that even though I have two TinyDB in the app,  it is all getting stored in one TinyDB.  Is there a way to separate these?  I had the app working properly before but it is not now.  Did something change?

SteveJG

unread,
Mar 2, 2016, 5:35:06 PM3/2/16
to MIT App Inventor Forum
There is only one TinyDB ever in an AI2 app Nick.   What you have is two instances of the same database with different names.  When you use clear.... it clears ALL the tags on the database.

Taifun

unread,
Mar 2, 2016, 8:03:02 PM3/2/16
to MIT App Inventor Forum
see the documentation http://ai2.appinventor.mit.edu/reference/components/storage.html#TinyDB

Each app has its own data store. There is only one data store per app. Even if you have multiple TinyDB components, they will use the same data store. To get the effect of separate stores, use different keys. You cannot use the TinyDB to pass data between two different apps on the phone, although you can use the TinyDB to share data between the different screens of a multi-screen app. 

and learn how to work with lists and list of lists


Taifun

Trying to push the limits of App Inventor! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun. 

Reply all
Reply to author
Forward
0 new messages