Hii. I am trying to add some values to a list so it could be stored in the TinyDB and I could show those values in another screen. But the message "The operation add items to list cannot accept the arguments" is showing, no matter how many times I try to fix it.
as Tim has pointed you, if you want to handle "LivrosDe" like a list, then to add elements to the list, you need to use the "add items to list" block, instead of to set directly a string to it.
I was useing the string only to make the title of the list change as the name of the user changes.
I changed the code make a list "global LivrosDe" and the i used the add items to list "global LivrosDe" with all the items of the first image I showed.
What I want is: To make a list with the title "LivrosDe" + name of user that has loggedIn and add a value to all the items I listed.
How can I do that?
List have not "title". You can create a List of List, or use a dictionary or use the name of the user like Tag to store the list of books associated to the user so, with the username, you can easily recover his/her list of books, display it, or add elements to it.
So, using the username like Tag, if you are passing in the "start value" the username, you can get the list of books for that user in Initialize block:
That´s what I changed. And the notifier says it did sign in the book.
Now I want to show how many books a pearson have added to their shelf in another screen.
In "Leitura" screen, each time you are adding a book, you are overwriting the list...as I told you above, you need first to recover the list from TinyDB, then add the new item to the list, and store it again (under the same Tag). In this way, the stored list will contain the new book.
A simple example:
I changed what you said, but it still didn´t work. Do you think it could be because of the name that I am giving to the TAG?
My teacher uses append to list in every screen, but when I did, it showed an error message.
Yes, the tag must be the same when Getting and when storing (in all the screens you want to access to the same data).
If you want to use this Tag:
then use it also when getting the value.
Other good thing while testing, it is to clean the tags (or even the entire tinyDB) between tests, to ensure that no invalid data is left between tests (you have blocks for this purpose in tinyDB).
I used this to see if the list was empty of not. It didnt write DESGRAÇA, but appeared an error saying you cant pick a random item of a list that is empty