I am creating a character Tracker for a boardgame.
I have created the stat-page with success. and saving it to Tiny DB.
I have set up so everytime the user saves a character, a tag with the name of the character as a value.
Now the issue, in the page "Saved characters, i want to create a dynamic button, that will pick up every Tiny DB with the tag “Character” and save it with the value from the tag. and if a new character is created a new button with the new name will pop up, and the old is stil present.
A dictionary is a set of data made up of a key and a value, like in TinyDB.
Its advantages are:
it’s a single file
it’s a JSON (a file format used by practically any platform) which, as I explained, can be easily integrated into a server.
data is easily obtained through the blocks get value for key and get value at keypath, as in the example I showed you
And just as you can easily retrieve the data, you can also write data with the blocks set value for key and set value for keypath
data manipulation is much simpler compared to using TinyDB
Well, it would be enough to save the dictionary to TinyDB at each modification, but you also need to consider that in case the app is uninstalled no data would remain on the device, and you would have to implement data saving on Firebase, for example.
I don’t know if you’re managing the buttons with the RecyclerView extension, DynamicComponent or with the native dynamic components.
Anyway, if it’s DynamicComponent/native components, inside a for each you place your blocks to generate the buttons.
Leaving aside the apply-to-args error that will be fixed,
this happens because the variable heroes is empty, try adding two pairs with the key as the character’s name and the value as empty.