Where is my file?

Dear all,
Two years ago I built an application that still runs on my phone (Android 14). When I installed it I associated a file called "Analisis.csv" using the syntax //Analisis.csv
Now I wanted to update a routine within the app using .AppendToFile. The app accepts it if I write the file name as /Analisis.csv but not if I write //Analisis.csv
However, when I open the app again, the recently entered data(s) do not appear in the list.
I can't/don't know how to access the file on my phone, so I can't know if it was updated or not. I know that there have been changes in the way files are saved but frankly I don't know how I should invoke the modified file so that I can use all the data I have saved.
Any help will be appreciated.

blocks (3)


Your original csv is in your assets / media folder, and is READ ONLY, you cannot save any new data there.

You have been saving the file with new data to your ASD (if working on an Android 10 + device)

Ok. I understand. Now, what do I have to do to call the new saved file in the ASD when I run the App? Should I invoke it as /Analisis.csv when I start the app?

Try it !

Ok. I managed to load the last data entered but I lost all the other data that I had already in my original file. So I uploaded the original scv file again but it does not show its contents. Am I supposed to delete the existing file, exit the app, load the original csv file so that it is generated within the ASD automatically? I am a little confused

You need to ensure that you only copy / move the file in the assets on the first run of the app only.

You can do this with a tag in tinydb.

e.g.

If tag is false then
copy file to ASD (so that you can then append data to it)
then set the tag to true

else (if true)
do nothing

There is an example of this in Taifun's fileByFile example

blocks (6)

The fileScope Add represents the ASD? or should I select Private?

Why not combine the two into one .csv file?

I would like to do that but I dont know how to do it. I am trying to copy the asset file into the ASD, but still not succeeding.

Remove the / in the last text blocks with the filename.

FileScope App will set the ASD

ok. Thanks

Use a text editor of your choice to prepare the file as you need it, then upload it into the assets of your app

You do not need any slashes anymore...
File scope Assets replaces the 2 slashes, which have been required before file scopes have been introduced

Taifun

Thanks @Taifun. I can do it right now that Im playing with the app, but in the future the idea is to add more and more analysys in a database that can be modified while running the app

Actually after testing with companion, both approaches work:

Yes, because App Inventor tries to be as user friendly and backwards compatible as possible

Taifun

A double slash always works with all FileScope as FileScope=Asset. Is this really user-friendly?

It should only work with FileScope=Legacy.

1 Like

Interesting feature...
A double slash overwrites the file scope... :stuck_out_tongue:

Taifun