I try to store three different lists to an TinyDB using different tags. But it seems to be not possible. When the data should be read from TinyDB for 2nd and 3rd tag (when Screen2 initialize), I get this error: “The operation select list item cannot accept the arguments”. Also when I try to add additional items after restarting the app, I get the error:
“The operation add items to list cannot accept the arguments”. For the 1st tag “Bezeichnung” it works fine. Seems like it is not possible to store different tags in TinyDB? What am I doing wrong?
You are not saving a list to the 2nd and 3rd tinydb tags, just a text value, no list to change the selection index with
You do not appear to be calling these two tags anywhere, except on Screen2.Initialise
You do not appear to be using Listview1 for anything, no after picking event ?
You should Close Screen2 to go to Screen1 ( if you do not switch screens correctly you will run out of memory and your app will crash
Why do you need 2 screens?
See below:
Use different screens wisely
Before starting to create another screen, first you should think about is it really necessary?
The problem here is caused because you are mixing different variable types.
When you initialize Screen2, TinyDB fetches that tag. However, GetValue will return a string if it finds content: it does not get automatically converted to list.
This means that the select list item raises the cannot accept the arguments error. You are trying to get an item from a string, and not from a list. And consequently, the same happens with add items to list; it fails because the variable is a string and not a list.
SOLUTION: convert when reading and writing data from and to TinyDB:
Use the list from csv row block with the Get Value block. This will convert all fetched data, which will be stored as a CSV row, into a list with which you can work.
Use the list to csv row block with the Store Value block. This converts the list into a string using CSV format, which is used later to be read.
Thank you! Of course it was not a list storing to db. It seems it was too late in the night and half of my brain was already sleeping. Such a easy mistake.
I just used 2 screens as a kind of different workspaces, only for learning and testing (I start up with AppInventor yesterday ;o) Thank you for these hints and MERY CHRISTMAS.