Save a list of numbers with tinydb

Hi,

I try to do an application to save several lists at tinydb but I have a problem to save correct these lists in tinyDB

One of them are teams (strings) and the others are results (numbers).

I have a Listview to select a player so when select an option I read the lists of tinydb of this player.

At the operation view I have a text to put the team, and another buttons to set the results. In this View I have a button to add elements at these values at lists and then update tinyDB.

When I save this list at tinydb without exit to the view, I can save and its OK, but if I go to other view when I return to View to introduce information the list of teams it’s Ok but the others lists of results only has one the first value save it.

After a million proves I think that the problem is when I save the lists of numerics at tinyDB.

I do the same instructions for the list of teams and the rests… I don’t understand.

This is the blocks to button to save (on the left) to tinyDb and the other block when selectedItem to recover the data of the selected player.

Thanks and see you.

I see you use multiple Screens.

Globals get reset when you switch screens.

If you plan to update something in TinyDB, don't assume the matching global is equal to the TinyDB copy of it.
To be safe, refresh from TinyDB immediately before each update of a global list.

Thanks ABG,

The sequence of operations in the operational Screen (how You has seed it) is :

  1. Select player, charge list of TinyDB at list of memory
  2. Introduce data
  3. Save (add to lists the data and then save at TinyDB the lists of memory)
    Thanks

Export the aia and post it here

Here you are.
comptaClics.aia (22.0 KB)

  1. Push the button "jugar" to go for introduce data.
  2. Select player with ListView
  3. Insert data: with buttons +Participació +Recuperació +Perdues and introduce team with textBox
  4. Save data: button Desa Resultats
  5. Go main form
    And then repeat the same operation with other data.
    Thanks!

Here is a doc on how to keep teams, players, and scores in TinyDB using compound tags.

Thanks for the UltimateScoreKeeper, I think the main idea of this project it's the same of mine.
I think that the problem is:

  1. While I add elements at list without retrieve of tinydb i have a correct list the numbers without decimals.
  2. But if I retrieve the list of tinyDB, It returns a list the numbers but with decimals. Then when I try to add a number without decimals at list, It don't add.
    What do you think? @ABG
    Thanks!!

Are you in France, where commas are used as decimal points?

Also, consider reducing the number of global variables in your code, and refer to what's stored in TinyDB directly wherever possible. That reduces confusion as to what data is current.

I'm in Spain.
Thanks for the advice, but I think that I need one global variable for each list I have.
In my casse I have 1 list of teams and 3 lists for integer values.
Thanks

in case you have not yet learned to work with tables, and

to keep things by name.