Is there a problem with trying to clear list?

I've seen a few people who have had issues with trying to empty a list. There isn't a clear list option in app inventor. I've tried using create empty list but doesn't seem to work, the new data adds to what was there and I thought I had cleared with create empty list.

There is a problem! It works fine when I come out of my app, clearing the variable containing the list, and go back in. Is there a solution?

You do not show how you cleared your List Matt. This is how to do it in Button4; it is this simple.

clearList

Are you perhaps emptying or 'clearing' the List but not clearing the Label or ListViewer you display the contents of the List in?

2 Likes

neckMachineV3_copy.aia (114.3 KB) I tried your method and it didn't work.

Why would it work when I come out of the app then?

If you show the relevant block images you might be able to get advice. I can't find where you do what you say you do in your SIX screens. You are possibly not clearing the TinyDB.

I suspect you did not clear the list without clearing the TinyDB or wherever you store your stuff. Clear the List, then clear the TinyDB by writing over the Tag might work.

How do I show just the blocks I'm having issues with?

Your app refers to the same TinyDB1 Namespace with three different names.
You compensate for that by extending your tags with constant text, but it will burn you sooner or later.

P.S. You also open Screen1 again instead of closing your screen(s).

Probably but that isn't the issue.

Right click on your Block of interest (for instance where shown in red), the pop up appears. Save the image using Download Blocks as PNG, then drag the image you get into the message area.

copyBlockImage

Where is image the create empty list block.

It possibly should be in set global data to the empty text block ???? or ????

Your image does not show where you tried to clear the List. What List are you trying to clear and where is the code? As indicated earlier, I expect you are not using code to clear DbTrainees. You can write over it.

This wrong:

I have an issue with data not being clear from a list when the app is running, however if I come out of my app and go back in my app works as it should. I see other people are having issues with this.

Hi @mattmanning

Can you be a bit more specific about how you're clearing the list in your app? For example, if you export your block workspace (right click and select "Download as PNG") and post it here we might be able to better help you.

Isn't there another thread open and active for this topic already?

I posted this on the general forum as well

I know it doesn't say create new list but I tried that and it didn't work, I tried setting the global variable to zero, no joy. Itried removing each item in the list still didn't work, but I come out of the app and go back in and it works fine.

You didn't clear the list you keep in TinyDb.

Here's some advice I expect you to ignore ...

Don't use global variables around Tinydb, if you can avoid it.
They give you a false impression that you are working with your data, while the real data sits there in TinyDB.