When I call to clear the list, I want it to be cleared of all data

I have a health care list
Is it possible that when I press the add button and the fields are empty, nothing is added?
Also can I delete only one or some selected data?


Hello,

yes, use an "if-then" statement to check if the fields are not empty.

If not empty
Then insert/store a new item.

To delete, I think you can only select the items from the ListView one by one.

you did not understand the purpose of the valueIfTagNotThere socket
for lists you should use a create empty list block there
like this you also can remove the if statement completely

Taifun

I couldn't understand what you mean.
If you want, make an example with pictures, so that I can understand more easily

When you are handling list in TinyDB the value if the Tag doesn't exist must be a list...an empty list:
image

If you check also this in your getdata procedure will find out that the "if" statement is left over because if the Tag doesn't exist you will have an empty list.


Please, think that I am stupid and do not understand easily.
I have done these...The problem is the same

Look at the Taifun response...the same here:

image

and only "set global list" and "set ListView" in the procedure:

Screenshot_2
The problem remains!!!

I think you finally didn't implement this...to avoid storing in TinyDB when the input fields are empty.

Screenshot_1
Unfortunately I'm stuck, I can't find a way out.
And the stupid joke is that I try so hard and I'm still in the same place and sometimes I make it worse.

Not there...Which is your problem? you don't want to store in TinyDB anything when your textBoxes are empty, right? So, that is the part you have to protect with the if statement. So, before to add item to the list, and before to Store a new value, check if the textBoxes or whatever you want are not empty.

image

You can nest as many conditions as you want in the if statement.

1 Like

I want: After I press the button add and I have written the fields only then data that I have written is saved.
And when one day I want to delete them, so that they are all deleted and not appear again every time I press the button add.
The button add should only put the new data, not the ones I deleted, and put them back again and again, every time I press this button.

When you have a new item, you are adding it to a list and is that list what you are storing in TinyDB, and that list is what you are displaying in ListView.

At this point, you need to check if the fields to add to the list are empty or not (this is what I understand you were requesting in before responses..).

To delete item, you need to do the same, that is, remove the item from the list and, with the new list (without the removed item), store it in tinyDB and display this list in ListView.

When you start the app, you have to read the tag from tinyDB, initialize that list with whatever is stored in tinyDB and display it is ListView.


Now it works correctly, it deletes everything with the delete button and doesn't put it back together with new data

It certainly has many shortcomings, which I can't think of at the moment.
If you want I can upload the AIA file

I think it's time for you to understand what you do in your code, how it works and how to assemble the pieces...otherwise, as we have already proven, it is very difficult to move forward without knowing what you are doing.
So move forward step by step, first one thing and, when it is resolved, the next.

You can start, for example, by checking whether the fields are empty or not, to create a new element.

Right, I agree...

For this app
Even better would be if after adding some invalid data by mistake, I could select those invalid data and delete only those, i.e. also +an option to delete data by selection

For that point...this is the event triggered when you chose an item in the ListView:
image

and this property indicates the index of that element:
image

So, after select an item in your ListView, you can write inside that event whatever you want to do. In your case, to remove the item from the list. You can do it using list blocks and the SelectonIndex.

Then, once the item has been removed from the list, you have to store the list in TinyDB and display it in ListView.

Now I'm going to play with it, I'm going to try it.

I thought it would be nicer if I could also put statistical tables showing the progress of the measurement findings

For the table, you could use this: