Save CSV data / list as a file

Use only the File.ReadFrom block without the filepicker as you did it in your latest screenshot

Taifun

Sorry but I don' t know what you mean. I shall delete the block out of the (how is it called...) "blocks development view"? I dont push the file picker. I only wanted to say that this logic still woks if i use it but opening the file in screen.initialize does not. I don't have the file picker in screen.initialize. This functionality only coexists.

@Taifun
I tried the following: I put the logic from initialize behind a switch (changed event). It also does not work. so it is not a problem of screen.initialize.

image

Then I tried writing a text in a label to make it visible if the logic of GotText is reached. That does only work with the file picker. In other cases when file.ReadFrom is called the event might not be triggered. Or an error occures when opening the file.

image

The last thing i tried for today is the following. I inserted some blocks in screen. inizalize shown below. While I was doing that the app asks for permissions for video, media and so on. I granted it. When testing nothing happens. Also the notifiere does not show anything.

image

It's unbelievable that such seemingly simple things can be so complicated or maybe I'm just stupid.

To read a text file which is owned by your own app normally no permission would be required, see also Some basics on Android storage system
Do you still get that permission dialog if you remove the filepicker component completely?
Let's see what our specialist @Anke is saying..

What you could do is to read the file after these permissions have been granted...

Taifun

Have you considered instead just saving the file off your device to an online resource ? Online storage is free/cheap and easy to use and access from your android device..

Yes, this is a bug on Android 13+ that I've definitely mentioned several times before. READ permission is requested incorrectly. Use my MFile extension to avoid this bug.

@ewpatton

1 Like

Unfortunately, I'm not a fan of the public cloud. If it were possible with a private mini cloud (usb device connected to fritz.box) I would consider it. I can't imagine it being easier.

@Anke, @Taifun: Thank you for all your support and Infos! I have taken a quick approach with the MFile extension. But quick approaches are never good. Unfortunately I didn't get it run. I had a look in the video and the blocks picture and thought that I understand what I have to do. But maybe I made a misstake or overlook something.

Unfortunately I can not spend more time at the moment. The weekend is over and I have to start programming for my job.

Now I have restored everything to standard file component. I'll give MFile another chance next weekend.

If not successful I'll build it in different way. I will request that the user (i.e. me) load the higscore at the beginning via the file picker (that's how it works). I use an indicator to determine whether the file has been loaded or not. Until that happens, I will simply not allow certain functions (e.g. deactivate the start button for the game)

Thanks again to you. I will be back as soon as i have new findings which might be interesting for others and leisure time

I use my own server, with my own security and encryption where necessary .

Need to go and find out what a Fritz box is :wink:

I would say it is in Germany the most common router for DSL / Internet / WLAN.

https://avm.de/produkte/fritzbox/fritzbox-7590/

Some of the devices (e.g. the one in the link) has a USB Port where you can plug in e.g. an externel HDD (in my case a SSD). The data which ist stored there can be accessed erverywhere in your local WLAN or also from Outside if you configure it. So it is one of a very simple kind of a NAS (network attached server).

I thought to buy something professional like from QNAP or Synology but for the moment it is too much for my needs.

Here are all the blocks you need (with a small correction):

Explain in more detail what role the FilePicker plays and show all relevant blocks.

After a long time I tried to continue with my app. It seams not to be a good day. In meanwile I read some more about the file scopes and i am more confused as before.Somewhere it was written that legacy ("Erbe" = compatibility mode) should not be used because it will disappear. For that reason I desided to use the build in File Component. But now I get the following error. I do not know what it means. Never got this error before.

Regarding the file picker: I do not need it. It is a workaround because when loading the file in screen.initialize the method file.gottext is not processed. If it still will not work automatically i will use a button to load the file. The file shall be created if it does not exist. So i do not need to pick up a file. The file for the highscore will always be the same for that app (hopefully).

Can you please give me a further hint what i am doing wrong? I hate that Android restrictions and the problems coming up with it when using file components in an own app which is created by the user itself.

Did you connect to Companion via USB?

See also here:

The File component needs (uses) a relative path (not a full or absolute).

"today" ist not "my day". Yes it was a misstake. I changed it after making the screenshot. but there is no difference. I do not understand where the join result comes from.

What you point out in the line from you ist new for me. I was happy to get it finally run with the AIStarter (and that many versions and different kinds of installations exists). When we wrote in march to that topic the problem did not occur. I will have a further look to my test/experimental project. maybe i find any difference...

if I do it like this the file is created...

image

save in the open procedure only for a quick test purpose

it seam to be a problem only in the file.exists function. is there a possibility to recognize the error when trying open the file when it is not existing e.g. in event screen.error and create the file initially in that case (in the way i tried it with file.exists) but without that function

grafik

file.exists function does not work for me. it looks good when i am insert it. but than after first run i get that error shown above. I did it now in that way ant it seems to work. when i delete the file on pc a new one is created. when i am insert dummy lines in the file (on pc) than the file is recognized by the app and it is not created again with initial content. what i can not explain is that now the file.got text event works even when file is loaded in screen.initialize event. i use now the app specific directory. as i can access it with file explorere on pc i think that it would be sufficient for my purpose. maybe i write a copy method to transfer it to documents directory (this should work because it worked already in the past)

i analyzed the error like this in screen.erroroccurred
image

now i implemented it as follows

event gottext is processed and the tableview extension is filled with correct values.
image

thanks for your help. i am not glad with my solution (in business job i would never check an error number or type directly) but i should learn that it is not always efficient trying to reach a 100% solution. i was very glad about that mit app stuff but this topic leads me to a point where thinking about to learn one programming language more and develop directly with android studio :wink: the complicated file handling still would persist but there are some effects can not explain. maybe there are synching problems or other stuff. it is miraculouse that some things does not work an when trying it some hours, days or weeks later suddenly seam to be working. of course there might be also some stupid bowl errors (Schusselfehler by google translation)

what you post in your last picture for your join result is clear. but in my case (see pictures above) the join delivers 2 different results while the content of the variables "pathRelative" and "fileHighScorer" are the same and have never been changed). join result in save is correct. join result in file.exist is wrong and i can not explain where the prefix "file:// comes from" not from the content of the variable but maybe from an internal buffer in ai2 which is not initialized and contains still a value from an old reference for example "pathAbsolut")