Unable to remove item from list

It worked but i will have to off the app and on it , is there any way that if the person is removed , it will remove the person automatically without initializing the screen

Is there a way i can change that

Which did you want, initializing the screen or not initializing the screen?
It's up to you to code that after you call the removal procedure. It is a matter of taste.

Actually it works perfectly . Thank you a lot . Pls ABG go the topic ‘ adding sender id to sms ‘ , i will really appreciate your insight

A link would help find it ?
Also, I do not personally maintain an Android phone with cell service, so I skip SMS questions.

Adding sms sender id Thanks

I believe I replied to that thread already ...

If possible , do you know anyone else in the mit app inventor community that can help me with this . Maybe you could refer the topic to them so they can check it out . Thanks

The basic problem is that the Remove item from list block is not working... I have the same issue trying to remove the final entry in a list variable and it's driving me crazy. Try this:
1/ Isolate the item/field/register you wish to remove...put it at the beginning of the list, the end of the list, or identify the item number within the list.
2/ Using the Control block
For each number from 1
to length of list
by 1
if number not= (the number of the item you want to remove from the original list)
then
add item from original list , index number, to new file.
3/ Your new file should have all the items from the original file except the one you no longer want.
4/ Rename/copy new file to old file

I really like the App Inventor, but the issues I have with lists, of whether it has to be converted to csv and then converted back and the data is presented between ( ) and Replace doesn't work either etc etc etc.....

@spangle216 The remove list item Block works Jonathan, just not the way you expect.

Try this


The Button2 code appears to be what you want to . The example removes the last item in the original myList (which is an "e"). Create the Project and test. Does this do what you want? Provide you own code to save the modified List (which is now myList).

Edit: Sorry, the if statement in Button2 event handlers should be as shown in this updated image

Regards,
Steve

Greetings,

Thanks Steve for your prompt response.

Works fine when you have simple data, but I'm using list from csv tables and it doesn't work! :slight_smile:

List item removal causes immediate collapse of the item numbers to fill in gaps.
So if you want to traverse a list while removing items, start from item number length of list and step to 1 by -1. That will avoid the wave front of the collapse.

Further info:
AI2 lists are linked lists.
Proof:

image

This algorithm should remove the last item in the List from any List, regardless whether the List originates as a csv table or not. Provide a snippet of what your csv generated List looks like.

Do not get fixated on traversing a List to remove the Last item. You do not share your code Blocks so impossible to provide you specific advice. Perhaps Abraham's suggestion will work for you but I expect the problem is your existing code.

Reading (or rereading) one of these might help you.

Programming Lists of Data

or

Sajal's https://www.imagnity.com/tutorials/app-inventor/list-blocks-on-app-inventor/

You can see an example of the data in the globallstArchive result... a simple 4 column csv table.
It's worse than I thought... I can't remove ANY item from the list...
The select item from list result is in parentheses.
The variable globallstArchive result isn't.
Why do I have to use a text block routine to make list results presentable?

I'll do some reading up... thanks.

Because it is itself a list, You will have to use select an item again to get at the individual items within that list

Got that... thanks

The problem is the data that is imported (Excel .csv as .txt) I have been able to remove items generated by the app itself, but not the imported stuff. Could one of you please point me in the right direction here? Thanks very much.
Keep up the good work!

Here is your answer:

You need to set the "excel.csv as text" to a csv list from table to a variable

1 Like