Skip to first unread message

Maha Sabri

unread,
Nov 17, 2014, 4:18:45 AM11/17/14
to mitappinv...@googlegroups.com
i can't import csv files directly to a list ????
plz help.....
i'm tired of looking around...and all examples are of tinyDB and webviewr....
i want to store from csv to list
thank you

SteveJG

unread,
Nov 17, 2014, 8:26:48 AM11/17/14
to mitappinv...@googlegroups.com
Yes, you can import csv data directly to Lists.  There is frequently no need to import them into a TinyDB and then use them in a list.
If you can do it with a TinyDb, you can adapt the code to using a List.

Be careful "i want to store from csv to list"    You can only temporarily 'store' to a List.  When the app closes, all data in the List disappears; so if you have to store your results, you will most likely need a TinyDB.   Data in a list is ephemeral, in a TinyDB it is persistent.

What have you tried?    Post a screen capture of your blocks and you will get advice.

Regards,
Steve

Taifun

unread,
Nov 17, 2014, 8:36:41 AM11/17/14
to mitappinv...@googlegroups.com
use the list from csv table block, see also the documentation http://appinventor.mit.edu/explore/ai2/support/blocks/lists.html#listfromcsvtable

list from csv table

Parses a text as a CSV (comma-separated value) formatted table to produce a list of rows, each of which is a list of fields.
Rows can be separated by newlines (\n) or CRLF (\r\n).

Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         

Maha Sabri

unread,
Nov 17, 2014, 8:56:06 PM11/17/14
to mitappinv...@googlegroups.com

tank you for your attention.....
well, i tried a lot !!
this is my last approach......
this is do NOTHING !!!
(p.s.: the file uuu.csv already in th assets)
thank you again...

Maha Sabri

unread,
Nov 17, 2014, 8:58:26 PM11/17/14
to mitappinv...@googlegroups.com

this is my last approach....and it did nothing but showing a text in the spinner or on the label......so plz help!!
thank you for you attention


Maha Sabri

unread,
Nov 17, 2014, 9:37:48 PM11/17/14
to mitappinv...@googlegroups.com
and i'm going to READ from csv file.....i'm not gonna store anything!!!
sorry for not expressing the case very well!!!

Taifun

unread,
Nov 17, 2014, 9:42:31 PM11/17/14
to
if you want to read from a file, you should use the File component together with the File.ReadFrom block, see also the documentation http://ai2.appinventor.mit.edu/reference/components/storage.html#File

then in the File.GotEvent block use the mentioned list from csv table block to convert the text into a list
Taifun

Maha Sabri

unread,
Nov 17, 2014, 10:12:46 PM11/17/14
to

I've done that before....and get stuck as shown.............
it displays nothing



phantomfoot

unread,
Nov 18, 2014, 8:11:01 AM11/18/14
to mitappinv...@googlegroups.com
The file name needs a path. e.g. /mnt/sdcard/uuu.csv or file:///android_asset/uuu.csv
Message has been deleted

Maha Sabri

unread,
Nov 18, 2014, 12:34:44 PM11/18/14
to mitappinv...@googlegroups.com

yeeeeey!!!
it worked....finally....
thank you all for your helpful notes...


Maha Sabri

unread,
Nov 21, 2014, 7:19:18 AM11/21/14
to mitappinv...@googlegroups.com
and now ...csv file encoding issue...
arabic chars. shows as ?????????
i've saved the file with different encoding...non worked!!!

SteveJG

unread,
Nov 21, 2014, 7:48:36 AM11/21/14
to
What does your arabic character csv look like?     Arabic is a right to left scripting language      ,اسمي ستيف ,أنا أعيش في ولاية تكساس , أحب AI2 هذا هو مثال باستخدام. AI2 لبناء التطبيق متعدد اللغات. أرجو أن أكون حصلت على الترميز صحيحة        is what an Arabic csv should look like.  You should also use the Screen Property    AlignHorizontal and set it to Right   ; unfortunately AI2 does not have a block to make that setting so you may have to put your Arabic on a separate screen if you are switching between languages.  Pardon my Arabic, I know very little and what is in the Arabic csv is the result of Google Translate.

Edit:  These screens are created by using csv files:





When you save your Arabic script in perhaps Notepad or where ever, did you set encoding to UTF-8 and save as UTF-8?


Regards,
Steve  .... please respond in the forum; please DO NOT send me emails.  Thank you.


Reply all
Reply to author
Forward
0 new messages