store multiple values in tinydb

2,835 views
Skip to first unread message

tec...@gmail.com

unread,
Apr 14, 2014, 11:55:28 AM4/14/14
to mitappinv...@googlegroups.com
Hey guys im abit lost in the new version of appinventor...

my first question is thet i want to insert form values in tinydb

name

phone

notes

so i got the insert part but how can i store all the values?

cause like this it only shows one value ..notes.

and how do we define variables now?


ryanj...@gmail.com

unread,
Apr 14, 2014, 12:06:27 PM4/14/14
to mitappinv...@googlegroups.com, tec...@gmail.com
I think I see the problem...
You're using the same tag ("tag") for each entry.
Since they are separate data values, try using a different tag for each one.

Enis

unread,
Apr 14, 2014, 12:31:13 PM4/14/14
to
A tag is an identifier.  Every record in the database has to have a unique identifier.  If you use "tag" over and over, you just keep overwriting the value for "tag" over and over too.
You can store things in lists and then store those in the TinyDB.  In your example.  "tag" will first be name, then phone, then notes.  Since Notes was the last one you stored, it'll be the only value for "tag."

You could store the values for the first person as a 3 piece list, then save that list as the value to a UNIQUE tag...

Also, in your second block, you're not clearing notes, but instead putting ther word "Empty" in the the notes text box.  Clear it by putting a blank string in there instead.

In the blocks Editor, go to the Variables link in the left hand panel.

tec...@gmail.com

unread,
Apr 14, 2014, 3:23:39 PM4/14/14
to mitappinv...@googlegroups.com

this seems to work but only shows the name..




On Monday, April 14, 2014 12:29:41 PM UTC-4, Enis wrote:
A tag is an identifier.  Every record in the database has to have a unique identifier.  If you use "tag" over and over, you just keep overwriting the value for "tag" over and over too.
You can store things in lists and then store those in the TinyDB.  In your example.  "tag" will first be name, then phone, then notes.  Since Notes was the last one you stored, it'll be the only value for "tag."

You could store the values for the first person as a 3 piece list, then save that list as the value to a UNIQUE tag...

Also, in your second block, you're not clearing notes, but instead putting ther word "Empty" in the the notes text box.  Clear it by putting a blank string in there instead.

In the blocks Editor, go to the Variables link in the left hand panel.

On Monday, April 14, 2014 11:55:28 AM UTC-4, tec...@gmail.com wrote:

Enis

unread,
Apr 14, 2014, 3:53:42 PM4/14/14
to mitappinv...@googlegroups.com, tec...@gmail.com
Michael... I've already answered this to you privately, but I'm glad you came back to the forum and posted up here again.

USE THE NAME OF THE CLIENT AS YOUR TAG... I told you this already.  If you use clients, you'll only have ONE database entry.

When you call the list back, you have a LIST... you have to break that list down into it's separate elements, and post whatever one you want, a SINGLE one, to that textbox.  You put a LIST into that value, so you'll get back a LIST.... that list has separate components, and each one has to be dealt with separately.

tec...@gmail.com

unread,
Apr 14, 2014, 3:57:57 PM4/14/14
to mitappinv...@googlegroups.com, tec...@gmail.com
shoot..i fergot that..works now but the list part i need to figure.

thx

Enis

unread,
Apr 14, 2014, 4:09:36 PM4/14/14
to mitappinv...@googlegroups.com, tec...@gmail.com
You get list items almost the same way you get the value from the tinydb.  Look in the list drawer and those blocks will make sense to you...  You can get the tags for the TinyDB which is all of the tags at once, and you can extract a single item from the database based upon the tag.  Simiarly, you extract the elements of the list... if you have 4 elements, you have 4 pieces to work with, with indexes starting at 1.  The first position is index 1, the second position in the list is two and so on...

tec...@gmail.com

unread,
Apr 15, 2014, 7:43:05 PM4/15/14
to mitappinv...@googlegroups.com, tec...@gmail.com
hey guys i hate to ask but im visuel..can somebody make a quick store and list in a list picker?

just so i can get it..then i can work on my project.....

Enis

unread,
Apr 15, 2014, 9:25:51 PM4/15/14
to mitappinv...@googlegroups.com
Here you go... three textboxes... name, birthdate, hometown, a TinyDB, listpicker and a list...

tec...@gmail.com

unread,
Apr 16, 2014, 6:22:11 AM4/16/14
to mitappinv...@googlegroups.com
ah great!thx keep you posted..looking for a book on app inv 2..

SteveJG

unread,
Apr 16, 2014, 7:51:39 AM4/16/14
to mitappinv...@googlegroups.com
@ teckker   Try here :     http://www.appinventor.org/book2
Reply all
Reply to author
Forward
0 new messages