Skip to first unread message

Apex

unread,
Feb 24, 2016, 9:58:31 AM2/24/16
to mitappinv...@googlegroups.com

Hi I've been struggling with this for over a week. I've tried everything so I ask for help, how can I make it so I have a buttons for deleting someone from the database and updating someones details from the database. The example I've been using is Stephen Zipprich's great example "TinyDB". Thank you all in advanced!

Apex

unread,
Feb 24, 2016, 10:27:48 AM2/24/16
to mitappinv...@googlegroups.com

The programming blocks



My Attempt for delete



No idea how to do edit...





SteveJG

unread,
Feb 24, 2016, 10:40:19 AM2/24/16
to MIT App Inventor Forum
To start, how about   TinyDB1.ClearTag  tag    where you place the tag with the persons name?  That will delete the person and all the data associated with that person.

To edit, just write over the Existing tag with the new values?

Apex

unread,
Feb 24, 2016, 11:24:35 AM2/24/16
to MIT App Inventor Forum
Tried TinyDB1.ClearTag  tag I think.. this is it...

but it still appears on the listpicker came up with the error

Bad arguments to select list item.
The operation select list item cannot accept the arguments: [*empty-string*] [1]



SteveJG

unread,
Feb 24, 2016, 11:45:08 AM2/24/16
to MIT App Inventor Forum
...ok...then what you need to do is UPDATE the ListPicker from the TinyDB perhaps. :)   because the person is deleted from the TinyDB.

Apex

unread,
Feb 24, 2016, 2:43:43 PM2/24/16
to MIT App Inventor Forum
Sorry but how would I go about doing that? :(

SteveJG

unread,
Feb 24, 2016, 4:19:42 PM2/24/16
to MIT App Inventor Forum
Use the TinyDB to populate a List or List of Lists, then assign the ListPicker to the List of Lists .

Apex

unread,
Feb 24, 2016, 4:43:17 PM2/24/16
to mitappinv...@googlegroups.com

I had a go.. this is what I though..

It clears the rags but it still doesn't removed the deleted person from the listpicker..


SteveJG

unread,
Feb 24, 2016, 4:56:52 PM2/24/16
to mitappinv...@googlegroups.com
to change what is in the ListPicker, you have to change lstpNames.Elements to reflect the tags in the TinyDB.   You can get a list of the current TinyDB tags using the  TinyDB1.GetTags block.    Your ListPicker will not update unless you tell it to      In the code you show, when you add items to list.... block as you do, what you are doing is putting the tag you just deleted back into the List ...don't you think so.... remove that block and see what happens Apex.  You do not want to add to the listpicker, you want to DELETE txtName from the global nameList perhaps?

simon hewitt

unread,
Feb 25, 2016, 4:19:35 AM2/25/16
to MIT App Inventor Forum
I am currently creating an app and i had to build a contacts section where i could add. Edit . And delete contacts. When i get home later after work i csn upload my blocks. I have a screen for the add contact. Then a screenfor the edit and delete contact. And thrn a screen for the list of contacts to choose from.

Scott Ferguson

unread,
Feb 25, 2016, 6:00:20 AM2/25/16
to MIT App Inventor Forum
See attached blocks image.
---
Capture.PNG

Apex

unread,
Feb 25, 2016, 10:59:50 AM2/25/16
to MIT App Inventor Forum
Could you provide me with a example with the global variables and blocks all together? Thank you.

Apex

unread,
Feb 25, 2016, 11:00:07 AM2/25/16
to MIT App Inventor Forum
That would be very helpful thanks. 

Abraham Getzler

unread,
Feb 25, 2016, 3:20:58 PM2/25/16
to MIT App Inventor Forum
@Apex,  to remove an element from a global list, you need to know its index in the list for the remove item from list block.
You get that from the ListView.SelectionIndex block, in the After Selected event block.

ABG


Apex

unread,
Mar 1, 2016, 7:16:24 AM3/1/16
to MIT App Inventor Forum
Can anyone please post a screenshot of the block diagram you are suggesting me to do? Really stuck on this...

Taifun

unread,
Mar 1, 2016, 8:03:37 PM3/1/16
to MIT App Inventor Forum


Taifun

Trying to push the limits of App Inventor! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun. 

Reply all
Reply to author
Forward
0 new messages