Delete single entry in tinydb app inventor 2

2,052 views
Skip to first unread message

Stephen Jones

unread,
Oct 14, 2015, 8:49:49 AM10/14/15
to MIT App Inventor Forum
I have created a member database for a small club and can add members to the database.
I also need to be able to delete individual members as and when they lapse




I can't work out how to do this.
This was my attempt.
Can anyone help?

SteveJG

unread,
Oct 14, 2015, 8:55:51 AM10/14/15
to MIT App Inventor Forum
Your method clears the name from the List.   To clear an individual TinyDB record, you should use the   TinyDB.ClearTag    
                                                                                                                                                                         tag               where the tag puzzle pieces is the record you want to eliminate.

You probably need to do that in addition of removing the member from the List that manages the contents of the TinyDB.  Does that seem right?


Try it and let us know what you discover.

Regards,
Steve

Stephen Jones

unread,
Oct 15, 2015, 7:48:56 AM10/15/15
to MIT App Inventor Forum
Thank you for that, would you be able to put an image of the blocks that would be used?

Thanks
Steve

SteveJG

unread,
Oct 15, 2015, 8:12:14 AM10/15/15
to MIT App Inventor Forum
A block like this will allow you to delete a single entry provided that each entry is stored as a tag  



Whether clearing a specfic tag is useful depends on how you set up your database.  How you have your organized your database  is not determinable from the image you posted.   If everything about the member is stored in the tag,  BadMember,  you can use the  above block to delete everything associated with BadMember.        If you have separate lists of members etc., what you have to do to remove a member name might be much more complicated.  Perhaps the following will explain:  http://ai2.appinventor.mit.edu/reference/components/storage.html#TinyDB  how the TinyDB works.   How  your records stored in the TinyDB determines exactly what you need to do.

We want you to have fun with App Inventor so here are some resources to help you learn to 
use the AI2 tools  A very good way to learn App Inventor is to read the free Inventor's 
Manual here in the AI2 free online eBook   http://www.appinventor.org/book2 ... the links 
are at the bottom of the Web page.  The book 'teaches' users how to program with AI2 
blocks.

There is a free programming course here 

http://www.appinventor.org/content/CourseInABox/Intro  and the aia files for the projects 

in the book are here:  http://www.appinventor.org/bookFiles  

How to do a lot of basic things with App Inventor are described here:  



Another free course is here:  course for Teachers in the link: 


How the components and AI2 works is described 

Regards,
Steve

Reply all
Reply to author
Forward
0 new messages