Storing Multiple Timestamps in TinyWebDB

Here are a couple of question from a reader of my blog, which focuses on app inventor apps that store/retrieve data from a web database or API. The second question specifically asks about storing multiple timestamps, e.g., if you were tracking your user’s activity or location. In general, it asks about how to store lists of data in a web database:

1. How can I check if a value is already stored in a TinywebDB ?

The only way to check for a value in the web db is to call TinyWebDB.getValue(tag). If there is no data value for the tag you send, the result in TinyWebDB.GotValue will be the empty string. You can check this by checking if the length of result is greater than 0.

2. Is it possible to store multiple arguments for one Tag at different time intervals ?(e.g.I save TAG 1, 2 and 3 right now it saves as an argument the current time of the system, then a few minutes or hours later I Save TAG 1,2 and 3 again and it puts a new a timestamp without overwriting the previous stored valued is this possible ? so at the end of the day if I check the Database I can have something like this Tag 1 (Time1, Time2, Time3, etc) for each stored value

Tinywebdb only stores one value for each tag. You can store a list as a value, however. So you could store different timestamps in a list, and store the entire list as a value of some tag. To implement this scheme, you need to load the list into your app using GetValue. Then call add item to list to add a new item (time stamp) to the list, then remember to call TinyWebDB.StoreValue to put the updated list back into the database.

For examples of storing lists of data using tinywebdb, check out the MakeQuiz/TakeQuiz sample chapter (ch 10), as well as the Database chapter (ch 22)


One Response

  1. Hi Mr. Wolber, I’m looking to see if I can use the Fusiontables control to build a more detailed database that has multiple columns. The current “pizza party” example (tutorial) was useful in showing how we can upload the data to our own Fusiontable. However, is it possible for you to shed some light on how we can “get” the saved data from the fusion tables as well? Thanks much in advance!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: