TinyDB with three fields to be created with two different "spinners" and with a textbox

@TIMAI2
I just noticed that break is missing: do you think it depends on this?
No, I just tried: it doesn't depend on break
I just discovered that in my "global DB_Metafore" with the do it" is emptyI just discovered that in "" with the do it" is empty

Correct, the break block will just ensure that only the first match for the spinner selections is returned. Without the break block, you will return the last match, if there are multiple matches. If you want to return all matches for the spinner selections (which is possible because they are not unique), then you will need to create a list and add each one.

Check that your global DB_Metafore is actually an AI2 list of lists, and in the same format as I showed above, and that index = 3 will indeed return the contents of the saved textbox value.

@TIMAI2
scrnli_4_7_2023_21-32-19
this was already there

I just did the "do it" test on both "spinner selection": they correctly loaded the values I selected, after "is in list?"

That list structure will not work with the blocks I provided for you .

@TIMAI2
How should I change it?

Look again here:

@TIMAI2
I begin to think that the problem is that I did not understand the meaning of your blocks and, therefore, I was wrong to fill in mine:

  1. now I have changed my "initial global" like yours;
  2. your code "Button 1" I interpreted as code for the "writing" of individual items;
  3. your "Button 2" is used to have the text of the choice spinner1 and spinner2;
  4. your "button 3" to search for the precise text I need.
    If I made a mistake, as I imagine, correct me...

Button1 is to add a new record to the list of lists global db, containing a list of the contents of the textbox, and the two spinner selections. The list of lists global db is then stored to tinydb with a tag of DB.

Button2 retrieves the contents (value) of the tag DB which is, for display purposes, shown in a label. You should see that there is an outer list, inside of which are further lists, each contains the values set in the textbox and the two spinner selections
image

Button3 uses the current selections of each spinner to return the first item in global db, your list of records, that matches the two spinners, and displays the textbox value stored

@TIMAI2
Now I will review everything in the light of your explanation.
I forgot to tell you that the "search" is on one screen while "entering records" on another screen: can this be the cause of the error?
However I think my mistake in your "button 3" is where to put your "button2" earlier.

scrnli_4_7_2023_20-37-50
Indeed:

  1. in "global DB Metaphors" the contents of the database arrive correctly
  2. both "spinner selections" contain (verified with "do it") the values ​​I selected
  3. the problem is that with the code of your button 3, which I transcribed as you can see, it gives an error and does not show in the "Metaphor Text label" what I entered in the textbox
  4. I tried to insert your button2 at the beginning of my button to no avail...

Thanks again for your patience

First test all blocks on one screen. When you get that working, you need a method to transfer the spinner values to your other screen, and call in the tinydb tag DB to an AI2 list, in order to run the search function on the other screen

@TIMAI2
In the other screen there is the "database writing" and it works perfectly.
The problem is in this screen, that of "searching" with into the database.
As I already wrote in the previous post, everything works in the "search" except the writing in the label of the text previously written by me through the textbox: that is, I am one very small step away from the finish line.
In fact in my writing of your Button 3 with the "do it" the data appear correctly in my "global DB Metaphors" and in the "selections" of the two spinners; that is, he selected the right record but I was not able to show the corresponding one in the label field, the third, the one coming from the textbox.
I remind you, however, that I have not been able to enter your Button 2.
If you want, I'll send you my .aia, which you'll be able to correct immediately with your skills.
Thank you

Please do (upload aia), it it will save the world a lot of time

@TIMAI2
Metafore_Alfa1_15.aia (45,0 KB)

I'm writing you a small explanation of my "work in progress" app (when I've solved this problem I'll go back to taking care of the "design")
Screen 1= slideshow-start
Screen 2 = database search (here is the problem)
Screen "NewDataBase" = entry of records into the database (it works perfectly after your suggestions)
Screen 3 = space for tests (it will then be cancelled): for now there is the initial draft of the test-study to import .csv files and then store them in Tinydb (if needed, after testing, I'll ask for help :grinning_face_with_smiling_eyes:) which I'll curate after solving this problem...

Will take a look...

My Italian is not good enough to understand your workflows. All seems a bit chaotic.

@TIMAI2
I think that with your ability, it will be enough for you to look at the blocks: for the rest, look at the Italian as if they were Egyptian hieroglyphs :joy: :joy: :joy:

Perhpas @uskiara (Ugo) can take a look ?

My pleasure, @TIMAI2.

Ciao @erGrunfe (Fulvio),
mi devi però dare tempo di leggere tutto il thread. Stasera purtroppo sono impegnato (vita da pensionati :slight_smile: ), ma domattina lo guardo.
Se nel frattempo vuoi scrivermi in Italiano qualche dettaglio, puoi già mandarmelo via mail.
Buona serata,
Ugo.

1 Like

Innanzitutto grazie per aver preso in considerazione il mio problema di principiante :slightly_smiling_face:
Farai quando potrai...
Il problema è in screen 2: con i consigli di Tomai2 sono arrivato ad ottenere le esatte selection in entrambi gli spinner ma non riesco ad ottenere, nella label, il testo inserito precedentemente in textbox.
Calcola che per ora ho ancora inserito le metafore: mettici tu qualsiasi parola...
Ancora grazie

Aspetta a ringraziare finché non veniamo a capo del problema :slight_smile:
Io me la cavo di più con le interfacce con Arduino che con i database, comunque proviamoci.
Se compilo l'aia e lo metto sul mio tablet, gira ? Ovvero posso vedere quello che non funziona ?
Ho già visto che usi molti Screen, e questo è foriero di problemi di passaggio di dati tra uno schermo e l'altro. Inoltre nel cambiare schermo bisogna sempre essere sicuri che le sequenze di passaggio non lascino "pending" delle procedure o clocks, che potrebbero far crashare l'app.
Per questo consigliamo sempre a tutti i usare gli screen virtuali, che si ottengono semplicemente usando i layout (hor o vert) rendendoli visibili oppure nascondendoli all'occorrenza. Ma ormai è tardi, il tuo lavoro è già molto avanti e non ha senso riscriverlo.
Adesso provo a compilarlo e a vedere cos'è che non va. però tra un'oretta dovrò sospendere.
Ciao ciao.

PS ho visto un'altra cosa 21 warnings e 3 errori nei blocchi. Ma quindi l'aia che hai postato è quello buono ?