Dear All. I have a problem with data coming from TinyDB. When I select to retrieve the data ("Recuperar datos") it actually shows me what I uploaded for the selected date. However, when I want to generate a new load, on a day previously loaded in TinyDB (to add more data to that day), it shows me the last data loaded and not the ones that really correspond to that day. The problem I see is in the comparison, because even if it is true, it does not load the data in the variable global Datos. If I do a manual DO IT, and then call “rellenoDeDatos”, then the expected results are displayed. Can someone help me to solve it? I am uploading the aia just in case someone of you could test it.
Sorry, here you can see the relevants blocks of the problem. I formated the data as @ABG suggested, but when I press the btnCargar it compares the dates but make nothing until I mannually press do it
did you update diaSeleccionado in TinyDB with the correct data format?
in the screenshot you might want to add a Do it result for diaSeleccionado and hoy...
also the better method for comparing dates are the Duration methods from the clock component, which can return a positive or negative value Sensors
Duration(start,end)
Returns the milliseconds by which end follows start (+ or -)
I did update it. Now I deleted every entry. Let me do it again and I will show you. Thanks for your suggestion about the time. I will try to introduce it in the block. But for now the problem is that even though the comparison of the selected day in the tinydb altough it exists, it does not retrieve the contents as it does the app when I select the button Recuperar datos
When rellenarDatos is called, I do not get the data corresponding to the selected day (that should be 111, 222, and 333 for datos 1, 2 and 3, respectively)
@ABG: Here I am uploading the aia with al variables and staff names in english. I you can look at it, It will be of great help for me. I am stuck with it and cannot go further. Please pay attention to the procedure in btnLoadData. The routine do nothing except opening the date picker. If you Retrieve any data and then want to load another already loaded day, you will see that neither cleanTbx nor the fillingData subroutines will respond. Thank you so much in advance Datos_copy.aia (10.8 KB)
Thanks @TAIFUN and @ABG for your suggestions, but unfortunately neither of the 2 options worked for me. I think the problem is not in the TinyDB but in the btnLoadData procedure (previously btnCargar). When I load data after looking up information through btnRetrieveData (previously btnRecuperar), regardless of whether I load a date that had previous data, as if I was creating a new one, the data in the textboxes does not disappear, even when a refresh call is made through the cleanTbx subroutine. If that subroutine worked, no previous data should be seen (although the call to TinyDB would fail afterwards). It seems to me that the problem is in the very call of the btnLoadData button, as if there is a computer conflict when following the sequential events. Obviously, it is far beyond my reach to solve it. Note that the ListPk_Data.AfterPicking routine does practically the same thing as Loading Data (retrieves data from a TinyDB and fills the textboxes with the fillingData subroutine) and there is no problem displaying the results there.
In the competition for worst variable name, the name 'list' has long held the championship.
Now we have a new champion, 'data'.
(At least the name 'datos' might possibly be the name of a small island off the Greek coast populated by a tribe of Amazon women coders.)
What's wrong with such names, you ask?
Those names are useless in helping to distinguish among the possible types, purposes, quantities, and meanings of whatever such variables hold.
Your 'data' variable holds a table of some sort, with rows containing 2 columns, the first colun is some useless attribute name, and the second column is the value of that attribute.
You are doing nested selects, and I am not convinced you are using the right indices for each select at each level.
This is a case where local variables, well named, would help make clear what is happening.
Local variables can act as stepping stones in your fast moving stream of thought.
Without them, it is too easy to get swept under and drown in confusion.
Before I can attempt to understand your code, I would need to see:
a descriptive variable name for the collection of records in the variable formerly known as 'data', like 'cheeses'
a local variable for the currently selected row in the previous item in this list, like 'current_cheese'
a local variable name for column 1 of the current row, like 'cheese_attribute_name' (country?)
a local variable name for column 2 of the current row, like 'cheese_attribute_value' (France?)