I am currently working on an App which receive and display data. This part work perfectly and I would know input these data in a .csv file. In order to do that, I start by storing the incoming data in "TinyDB" which, once I click on a "save_button", give them to a file. I take the model of the procedure (last block) from other topics but it doesn't work here.
The tag naming looks dodgy Arthur - a Tag should start with a Character and ideally logical for ease of retrieving the data. So for example instead of W_val.txt, it should simply be W_val. If you are recording many W_vals, create the Tag names in sequence. For Example W_val1, W-val2 etc
Although I have corrected how you save to TinyDb, saving to TinyDb seems like overkill - you could just stream to a CSV file. If the App is later going to be used to display the data in some way, it can read from the CSV file.
This will only work if the TinyDB contains lists in it.
According to the error, the TinyDB contains such a tag that contains a value which is 0.
Possibilities why this could happen :
You've somewhere added something to the same TinyDB in number format (0).
You've multiple TinyDB s with the same namespace, in one of which you have added a non-list value. Try changing the namespace of the TinyDB to a unique name to avoid this problem.
I can clearly see the problem no. 1 in your blocks, under the Clock_Receive.Timer event.
There, data2 is a list containing items, and you are adding items of that list to the TinyDB, and those items are not lists, rather they are numeric values.
Tim's post will surely solve the problem, according to me.
Hi ChrisWard, I tested with your App but I got nothing back in my storage after a run.
Even if I give access to the App to my storage I got nothing more. So, I tried to change the "FileScope" to "Legacy" as I could read in similar topics from the forum but not better.
I also add an extension made by someone (found here :Error 908: The permission WRITE_EXTERNAL_STORAGE / bug) which may help in this situation but still nothing...
So I input the extansion I speak about in my last response and got this time the following message even if I gave all permission to my App about the storage in my phone :
Sorry, I tried to understand and search what you are explaining to me but I am lost (this is the first time I do programmation and work with a computer and I am a bit lost).
From what I understand, the following error come from the fact that the path does not exist :
So your proposition is to create a place or a path in my storage for the App :
Saving the file to just /myfile.csv (with the single slash) will save the file to your default read/write storage area.
On earlier android versions this may be to /storage/emulated/0 but on later versions Android 10+ (API 29+) it will be to the ASD - /storage/emulated/0/Android/data/<package_name>/files.
Earlier versions can use the ASD but you would need to target it with a path.
It is all very complicated...here is a good resource on what is happening:
I would always recommend you work to the dictates of the latest API, and keep things simple by using the default storage location.