Insert a list from my mobile phone (.csv) in a Listpicker

Hello
I will instert a list from my mobile phone in a Listpicker . Examble
I have a file with the name list.csv in my mobilephone as,fd,erf,dsas,ddf,fgh,ffg,fgg,fgh in /list.csv and I want to instert them in a Listpicker one below the other.
I have made the following
Καταγραφή
but the result is

when i change list to csv row list to list from csw table text


the result is
Καταγραφή

What am I doing wrong, what can I do?

  1. The list variable is supposed to be a list so initialize it as a list
  2. Use the "list from csv row" block instead of "list from csv table"

Can you upload the list.csv file here?
There might be surprises in it.

The "list from csv table" block creates a list when there are newline characters "\ n" in csv. When there is only one row, it will create a single-item list that contains the column list. It happened here.

I give you the same list in two forms. One with a comma in a row and one without a comma in a column. Please enter it in a listpicker and write me the code or send me the aia . Thanks
List2colum.txt (271.3 KB)
List1row.txt (265.2 KB)

CSV files have commas. Your first csv file has spaces. So before making a list from that csv, replace the spaces with commas. Or create a valid csv file with commas.

For AppInventor, columns are to be separated by commas, lines are just a new line (Enter on the keyboard).

Adapt to it:

List2Column

Must you pay for upstream sins downstream?

Your internal column delimiters are
' state_id ' and ' county_name '
including their surrounding spaces.

If you replace them with commas, the crlf- version might load as a true table.

please try to put one of the above lists on a Listpicker to tell me if it was done.

When I insert list1row.txt with list from csv row (because it has commas) or list2colum.txt with list from csv table (it one colum with new lines) the application crashes and closed !!!!

Try this List2colum.csv (271.3 KB)

Modify code according to your needs

Thanks , I did it exactly as above but when I press on Listpicker4 the application crashes and closed !!!!

Use my csv

It worked, but I do not want it that way. I want the city name and state Id and country Name Write on a line for selection , as in my list
List2colum.txt (271.3 KB)

Like this?

You will need to make one edit to your List2colum file, find the entry for "Islamorada" and remove the comma (replace with a -)

or just all on one line

image

1 Like

Thanks !!!!!
I will try it later.
I also want to ask, how can the line number of the item I selected appear?
For example, from a list of 5000 items, I select the 150th item from the Listpicker.
How can 150 appear somewhere?

Get the index of the selection. However, if you are using the search filter the index will be different, in which case you will get the index of the filtered list not the whole list. To overcome the, you could get the index from the supplied list using a contains block (possibly with the city name) to find the correct item and index. You may need to create a global variable for cities in my example instead of a local one.

Or this: listviewFromTxt.aia (126.0 KB)

Screenshot

grafik

Thanks to all of you !!!! :grinning: :+1:

Did you find a solution, if so please mark it.