Delete only the last 2 data in all listview records

Greetings, dear members of the forum. I have the following problem.
in a listview I enter data from 4 text boxes (as seen in the image) now I need the Delete button to delete only the last 2 data from all records (as seen in the red line part in the image); Only the #id and Names would remain. How could I achieve this? what would be the arrangement of blocks?
I have not found something similar to affect all records with a single click.
I will do this activity every day in the classroom.
I thank you in advance for your support

What about while creating the list from 4 text boxes additionally create a second list with only 2 text boxes?
Taifun

Thanks @Taifun The problem I've had is that the parallel list layout doesn't scroll together on the screen. which does not allow me to easily see who the Note and Assistance number corresponds to.
That's why I have a single Listview.. But now I need to delete those last two numbers for the next class :slightly_smiling_face:

This looks like a good time to use YAML as your Element format.

I'm not talking about scrolling listviews, I'm talking about creating 2 lists, the first will be displayed using the listview, the second to store only the 2 items you need later without displaying it

Taifun

or

https://gallery.appinventor.mit.edu/?galleryid=4990166434054144

or

or

and to remove the lat two items of each element

image

1 Like

@TIMAI2, Thank you for providing me with the block design, I tried it but I get an error

Is there another way?

I upload the .aia file

Error

BD_Listview_3Tbx.aia (15.1 KB)

Compare my blocks with yours.

In your blocks here:

image

replace item with "Temp"

1 Like

I'm sorry, thanks for the correction, I already applied it, it effectively cleans the last two digits of each record... but when I refresh the screen they appear again!!?
So I set the TinyBD to save the changes but it doesn't work... then I stay the same... I attach the block

You have not changed global Data_base.

If that is what you want then set global Data_base to ShortList, inside the local variable block, then save to tinyDB.

If you want to keep global Data_base as it is, then store ShortList to a different tag in tinydb

ok thanks, I already did it,...

but it comes out like this

Nearly :wink:

Like so:

2 Likes

Yes,.. now it works!! :grinning_face_with_smiling_eyes: :grinning_face_with_smiling_eyes: excellent, I am very grateful

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.