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

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 ?

Certo, vai tranquillo, non c'è niente di segreto.
Non c'è passaggio di dati se non con il Tinydb.
Da principiante, oltre al codice, nei blocks c è altro che sarà o inserito o cancellato.
Per esempio, nello screen NuovoDataBase c'è un primo abbozzo di come provare ad importare da csv.
Questo lo svilupperò dopo, quando il resto funzionerà.
Come poi, dopo aver studiato "di i" trasformerò nuovamente l'app.
È studio... :slightly_smiling_face:

In realtà io mi sto un po' preoccupando.... :grinning:
Ho visto che warnings ed errori sono un po' sparsi nei vari screen.
Ci sono molti blocchi disabilitati e altri che non sono completati (ad esempio un if then else che non ha nulla nell'else: non è grave ma crea un po' di confusione.. :flushed:
Quindi, nonostante gli errori, se compilo e creo l'apk, poi provo screen 2, è lì che trovo il problema ?
Tra l'altro, io metto tutti gli screen in dimensione monitor, così posso vedere più in grande. Tu avevi previsto solo la modalità telefono ?

Io ho usato, recentemente, soltanto l'emulatore.
Comunque, il problema è "soltanto" nello screen 2
Gli altri screen, nonostante i pezzi superflui, funziona tutto correttamente.
Dai uno sguardo nel Block dello screen 2 nel Button Mostra Strutture: li arrivano correttamente le selezioni dei due spinner e non sono riuscito a far vedere nella label Testo Metafora quanto scritto nel textbox precedentemente

Ti rispondo alla "Montesano": "ecchevvordì?" :rofl: :rofl: :rofl:
IUl problema è che ora sono al mare ed ho un monitor HDReady e non mi fa entrare tutta la pagina, in modalità telefono, senza scroll

Scusa ma item coma fa ad essere una lista ?
image
DB_Metafore è una lista di liste ? E anche così, visto che immagino tu la voglia recuperare dal TinyDB, e visto che non riesco a crearla, che struttura dovrebbe avere ? Immagino che ogni record sia di tre elementi: uno derivante da Spinner1, il secondo da Spinner2 ed il terzo sia il testo da visualizzare.
A parte il fatto che il break lo metterei nel then dell'if, comunque prima vorrei capire come item possa essere una lista :thinking:

Timai2 me l'ha fatta cancellare!
Tra poco sarò a casa e te la manderò

Dear @erGrunfe (Fulvio),
after the deep and pleasant mail exchange (in Italian :slight_smile: ) we had yesterday evening and this morning I revert again to you in English, so to allow @TIMAI2 and the other PU's to have a look to the advancement and therefore to participate to the discussion with their hints and suggestions.
According to what we have agreed, i focused the attention to Screen2 only.
In that Screen I've created directly, as a global variable, a (reduced size of the) Metafora database, just to have a sample of the structure that the final database will have.
Each record of the database is composed by three fields:

  1. Problematica (a text that acts as a pointer)
  2. Derivante Da (same as 1))
  3. The text of a "Metafora" related to the contents of 1) and 2)

"Problematica" is a simple list.
"Derivante Da" is a list of lists. Each element of Derivante Da is therefore a list of several elements related to the specific Problematica's elements
Spinner1 elements are preloaded with the Problematica list elements
Once selected within Spinner1 a specific Problematica element, then Spinner2 is filled with the elements contained in Derivante Da and corresponding to Problematica.
For example if the chosen Problematica element is the n.2 in the Problematica list, then from Derivante Da it will be picked up the list of "n" elements which build the second record of Derivante Da.

Once selected an element within Spinner2, the two selections: Spinner1.Selection and Spinner2.Selection become "pointers" to the Metafora database.
The word "pointers" is between quotes because they aren't numbers, but texts.
The searching algorithm within Metafora Database uses these two texts to find the element that contains Spinner1.Selection as field 1) and Derivante Da as field 2). Once found, the third field which contains the Metafora Text, is then shown.

You will see that I've inserted some comments by using the method suggested by @ChrisWard : i.e the use of a text global variable overwritten every time to make comments always visible and removable.

I've disabled some blocks that are useless (a comment line shows which ones)
For debug purposes you'll find two labels at the bottom of the screen. You can remove them, obviously, when you are done with the testing phase.

The main issue was (most probably) the fact that you made invisible the Spinners in the event "After Selection": this was causing the loss of the .Selection value (this was more evident in Spinner2 that was always returning SelectioIndex =1). I've therefore disabled the blocks which were making visible/not visible the Spinners because useless. By disabling those blocks the searching algorithm has started to work.
Last comment/hint: when you will fill the "real" Metafora database, please pay the maximum attention to insert EXACTLY the 1) and 2) texts, otherwise the searching algorithm will not find the matching strings.

The app has been tested as apk on a Lenovo tab M10HD featuring Android 10

The following .aia contains the above described version .
Metafore_Alfa1_15US.aia (46.8 KB)

Best wishes and..."per aspera ad astra" !!!!
Ciao, Ugo.

2 Likes

@uskiara

I'll go see right away :+1:

Works!
A huge thank you to Uskiara :heart_eyes: :heart_eyes: :heart_eyes:
Now I can continue by inserting the metaphors :+1:

1 Like

Dear @erGrunfe,
nice to have helped you a bit !
Feel free to ask again, should you need further details.
Best wishes, Ugo.

PS for dictionaries you can have a look to the tutorial from @Ghica

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.