I couldn't find this Tinydb question discussed

158 views
Skip to first unread message

Harry Mangurian

unread,
Aug 9, 2017, 8:26:36 AM8/9/17
to MIT App Inventor Forum

I read the docs, but I missed the definition of "key."  I too have multiple Tinydb in my app and it would be convenient to use the same tags in each.
So my question is:  Is the "key" the same as a "tag" or is the key the database name ?
thanks.

Question for MIT folks:  How difficult would it be for the AI developers to do the following ?  Modify all tags in Tinydb calls to append the name of the Tinydb being addressed and then strip that name in methods where tags are retrieved, so that the appendage is transparent to the user.  That is to say - for a Tinydb named MYdb,     "tag1" is stored internally as tag1MYdb, "tag2" as "tag2MYdb" etc.  This makes each Tinydb storage, with a unique name, look independent to the app developer.  Barring that capability, the app developer could write subroutines to append/remove the Tinydb name before using a tag.

Taifun

unread,
Aug 9, 2017, 12:06:53 PM8/9/17
to MIT App Inventor Forum
 I too have multiple Tinydb in my app and it would be convenient to use the same tags in each.
there is only one TinyDB, see the 
documentation http://ai2.appinventor.mit.edu/reference/components/storage.html#TinyDB

 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. 

So my question is:  Is the "key" the same as a "tag" or is the key the database name ?
yes, key and tag is the same

Taifun

Evan Patton

unread,
Aug 9, 2017, 1:24:21 PM8/9/17
to MIT App Inventor Forum
Hi Harry,

Regarding an answer to the last part of your question, please see my response on your other thread: https://groups.google.com/d/msg/mitappinventortest/lx7if7CL0FM/dZ8aec_tBwAJ

Evan

Harry Mangurian

unread,
Aug 9, 2017, 6:06:59 PM8/9/17
to MIT App Inventor Forum
Thanks go to Taifun and Evan for their answers.

Tim Carter

unread,
Aug 12, 2017, 7:49:41 PM8/12/17
to MIT App Inventor Forum
Harry

Juan Antonio has just added this extension, which more or less does what you want!

Harry Mangurian

unread,
Aug 12, 2017, 8:16:34 PM8/12/17
to MIT App Inventor Forum
Tim - Thanks for the info.
Reply all
Reply to author
Forward
0 new messages