The button 1 block adds a string to a row in the text file and a line return - \n. This is the correct format for a csv file (table).
Button 2 reads the file, then the contents are converted to an AI2 list of lists from the csv table, and for this purpose shown in a label. You can format and control this list however you want.
Thank you ! Now I succeeded doing things exactly as I wanted (and the blocks are more simple)
So my datas shouldn't be treated as lists but as text to be saved in the csv file ?
have a nice day !
Hello,
I am very proud to anounce that on Monday I will be able to give my first (almost) finished app to my first end user ... I can't wait !!
But (there's always a but) : this app refers to an external csv-file ; it worked perfectly when I was on companion, but my built app can't find the csv-file to read.
I have read and re-read (etc) the little text about slashes, I have pasted my file (obviously not) everywhere on my tablet but I can't find where to paste this file so my app can find it
Where should I paste my file if it's refered to /file.csv, //file.csv and file.csv ?
you mean internally stored ?
because it's a list of words my user will work with, and I want to load a new list when he's finished, or an custom list for another user.
does it seem right to you doing so ?
PS : not sure to fully understand what "asset" means or actually is ...
My idea is : I write the words-list on a computer (much more rapid) and I paste it in the right folder on my user's phone.
Then the app is reading it to retrieve every word in a list :
So if I understand well, this part is for me, but I should put a slash in my Read.File component ?
How do I give permission to Read_/write_external_storage ?
Where do I find these storage folder ? (sorry)
2. External Storage
The root directory of the External Storage is:
/storage/emulated/0/ or
file:///mnt/sdcard/ or
file:///storage/emulated/0/
To access the external storage, READ_/WRITE_EXTERNAL_STORAGE permission is required.
Tablet : 5.1.1
my Phone : 9
the end user's phone : don't know, haven't installed yet, I see him on Monday
I am sorry if I don't master either the vocabulary to explain what I am trying to do either the logic of programmation - I try to obtain a certain result with the "tools" I master +/- and try to learn new ones on this way
The app's goal is to show everyday a new word do end user (aphasic patient) and he has to do some "exercises" with that word. The presented words are taken from a list he gave me. This list consists of 280 words. Therefore, it's easier for me to type it on the computer in a csv-file and then send it on my device than entering it word by word via the app on the phone/tablet.
Furthermore, maybe later I will use the same principle with another patient, but not with the same words.
The solution I'm thinking about is having the word list stored externally from app, so I can change the list (or my patient can) whenever I want. It's probably not the smartest solution from a programmer point of view, if you have a better one I'll be glad to learn.
When I was building the app and working with companion, I sent the csv-file on my phone (via mail or dropbox) and copied-pasted it in the data subfolder of the App Inventor folder. I could easily load the wordlist using the dedicated button and component ... and now, I am wondering how to do this with the packaged app.
I hope my explanation are clearer ... and you can help me be a better programmer
is only created / used for degugging and is not available for the compiled app (APK). Files that are saved here (with the File component by saving a text file without a slash) are saved with the APK in the internal storage:
/data/user/0/<packageName>/files/
This directory is only accessible with a rooted device.
You should therefore save the csv file in a folder of the external storage, for example:
/storage/emulated/0/Documents/ or /storage/emulated/0/Download/
If you enter new, more words, the length of the list should actually increase, right?
And how does the user know which word from the list to work with afterwards? How does the user know which word was added?
Questions & questions ... so to shorten this, create a small test aia with only 3-5 words and post the blocks (aia). Put the csv file in the assets (Media).
ok ... some tries later :
with /liste.csv in Read.File component and the file pasted on sdcard/ it worked
how should I write the address if I want to decide the folder where file must be paste (and not simply the root of sdcard) ? /folder/subfolder/liste.csv ??
I hope you better understand my goal by seeing the result
About the wordlist : the app presents everyday a different word (one word per day) ; user can't choose.
The stock of words comes from 3 possible sources :
2 words are pre-stored as a startpoint
user can upload the csv-list (this list can be 10 or 1000 words if he wants) -> integrated in tinyDB (csv-file not modified)
user can enter new words manually one by one -> integrated in tinyDB (csv-file not modified)
Apart from doing some exercises with the word of the day, user can :
see list of previous words treated (and the responses he gave - my project for later is that he can modify his responses ; for now he can do it only the day he entered them)
see list of words stored in tinyDB, erase a word, erase the whole list, add a word or upload a csv-list
Instructions (or help section) for the user to know what he has to do and how to do it remain basic, at this point. I will show him tomorrow when I see him.
Thank you for having a look, I'll be glad to have your comments on how to improve this app's structure (from my point of view, the Screen.Initialize component is quite frightening )
I think I forgot to thank you, it may seem obvious to you but that was the information needed
App is now on my end user's phone (I asked him to report bugs ... I hope there are not too much !!)