Cannot load actual data from TinyDB

@ABG, here I am going again. I changed the variable names and routines to be more descriptive. I tried to declare a local variable to retrieve te values stored at the TinyDB and probably did something wrong because now I cannot store any value. I hope you have enough patience to give me a hand to try to solve the problem. I still think that it is not a problem of storing the values but of the flow of the program in btnLoadValues.
Datos_copy.aia (12.1 KB)

I loaded your project, did a Clean Up Blocks, and immediately saw

It reminds me of a movie I once saw, about a man doomed by a brain disease to wake up each morning without any knowledge of the past, and his wife's attempts to meet him for the first time every day.

That TinyDB.ClearAll block should be buried deep in a Setup menu, with a DANGER warning.

It has no business in a Screen1.Initialize event.

I think I saw a similar movie with Adam Sandler and Drew Barrymore. :thinking:

The clearall of the TinyDB I just put it there when dibugging, to reset the possible tags remaining in the base, but ones deleted I disabled it.

After going around the process several times (many hours) and not being able to solve the problem, I decided to create 2 separate subroutines. One to create new records and anotherone to edit previously loaded records. Holy remedy.
The problem was in the fillingData subroutine (probably because of the name). When calling findDay the correct day was recorded, but in the loop, the local variable dateValues recorded the previous record, whether it was previously displayed or loaded. When the same day was loaded again, it brought the correct values.
By separating the load subroutine from the edit subroutine the problems gone (but just the app problems).
Thank you for the suggestion about not declaring a global variable for loading the TinyDB registers. I found them difficult to debug, but makes the task easier. Cheers