TinyDB Problem checking if items already exist and delete item

Hi All

I am modifing an app i made in Appybuilder with some of the new options in Kodular and i’m trying to use TinyDB to save and retreive information. I add items to tinydb and retrieve items but i can’t check if the item already exists or delete an entry. I have tried to follow guides and videos on youtube and they have got me to where i am but just can’t seem to get the checks to work or delete an entry. I have attached a copy of my code so can someone advise on where i’m going wrong please.
It will be greatly appreciated.

it does not really make sense to use the same text as tag and value…
let me suggest to use only one tag and store a list as value



You are making this overly complicated in your Btn_Team_Add.Click block.

Basically, you are making 3 access to get the tags. Why 3?
Get Tags and assign it right away to Global Teams.
Then do the checking on whether it is a list on Global Teams, and if it is, proceed with the each item loop.
The way you have it now, you are asking the code to loop on something that may even be an empty list.

And as Taifun pointed out, what is the point of storing the tag itself as if it was the content? Presumably, there is something of value (players names, statistics and records, etc.) that would be worth saving besides the name of the team that is already known.

Then, there is the odd logic in that block.
Assume that you add a team (let’s call it “The Bulls” for argument sake) that did not exist before.
So, it will not be found in the list, and the logic would direct to add, to the global Teams list, the value of whatever is associated with that tag “The Bulls” in the database. Which will be pointless, as it was already established that the tag “The Bulls” didn’t exist before.

1 Like

Thanks for your replies both, they helped immensly along with videos i managed to find on youtube.
I have now managed to get the data stored with the required tag, but now need to get that info back out of tinydb to put in a dynamic component to create buttons depending on how many players were put in tinyDB. I managed to get it to work with if i manually assign a text block with the options in it but not from TinyDB. Please can you advise I’ve attached 2 screenshots, the black background screenshot is to show what i have done to try and get it to work and the white background is how i got it to work before manually.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.