The TinyDB component is a Tiny Database which is a component that stores data or information.


You can find the TinyDB in the storage tab in the palette column.

***Note it is an invisible component.
TinyDB_Find.pngTinyDB1_Invis.png

Why a database?

•You have been using variables to store things like an index to a list or the time remaining on the stop watch.
•You have also used a list variable to store a list of excuses.
•However, once you stop the app, the changed values of the variables are forgotten.
•To remember them, we need App Inventor to use some of the memory on your phone.
•The thing that stores and retrieves something from a data base is called a TinyDB and it located under Storage in the Designer window.


How does a database work?

You can put any label you want on the box. This is called the tag.
You can store whatever you want in the box. To do this you can use the ValueToStore connection.
TinyDB1.png

When you want to get something out, GetValue will do that.

A) It returns the value stored in the database.
B) If there is nothing stored , you can specify how you want the database to tell you that.
C) Look at the image below for an example.
TinyDB2.png

You can also add a clear statement to clear your Database.

TinyDBClear.png

There are many reasons to use a TinyDB

•Remember the highest score achieved on a game.

•Remember the new excuses added to the excuse list.

•Store names and pictures added in your name game.

•Remember colors you have created so you can use them again.

•Remember passwords for an application

•Can you think of others?