Italian Come fate a popolare una Grid ?

Pisinho

Active Member
Licensed User
Longtime User
Sono nuovo,
ho installato il mio RDC server e funziona tutto in base all'esempio del tutorial. Adesso vorrei fargli eseguire delle mie query su Database esistenti e fin qui tutto OK. Ma non so se esiste e come popolare una Griglia per far visualizzare i dati sul Tablet. Di sicuro esiste ma non capisco come farlo.. esiste qualche esempio / tutorial ? Grazie a tutti.
 

Pisinho

Active Member
Licensed User
Longtime User
Grazie, peccato faccia riferimento a SQLite.
Sto cercando esempi da collegare al risultato della query fatta tramite RDC. Sto iniziando a pensare che forse non è tanto banale scrivere codice con questo B4A, pensavo fosse più friendly il discorso di connessione ai Database Server.

Comunque grazie.
 

LucaMs

Expert
Licensed User
Longtime User
Beh, non so in che forma arrivino i dati tramite RDC, ora gli do un'occhiatina, ma poi basta trovare una view simil griglia, sul sito (anche negli esempi che ti ho detto). Anche nel manuale Beginner's Guide e nei suoi esempi allegati trovi delle "griglie" (scrollview).
Inoltre, potresti provare ad utilizzare la classe clsCheckList, anche se è più adatta per le liste verticali, che come griglia, puoi creare ogni Item con tutte le view che vuoi e non mostrare la checkbox.

Guardo in giro e ti faccio sapere se trovo qualcosa di già pronto
 

LucaMs

Expert
Licensed User
Longtime User
I dati che arrivano da RDC sono:

Type DBResult (Tag AsObject, Columns AsMap, Rows AsList)

Tag - The request tag.
Columns - A Map with the columns names as keys and the columns ordinals as values.
Rows - A list that holds an array of objects for each row in the result set.

ma tu hai già fatto delle prove e sicuramente lo saprai già e avrai capito come ottenere i dati.
 

Pisinho

Active Member
Licensed User
Longtime User
Grazie mille.
E' vero che sono registrato dal 27 Aprile 2012 ma solo come diaciamo 'sostenitore' visto che l'avevo fatto acquistare dall'azienda ma mai utilizzato visto che avevamo tutti BlackBerry, ma adesso le cose son cambiate e vorrei svilupparci qualcosa oltre alle mie maschere in Access e VBA.
Visto che ci sei, da quello che mi dici sopra, parli di view etc.. ma dove trovo ben spiegato il tutto ? Forse sono io che non mastico bene l'inglese ?
Mi sembra di tornare indietro quando all'inizio con Access s VBA mi sembrava impossibile che per aggiungere un record bisognava fare un monte di passaggi pur essendo dentro un 'motore' di database.
Per ora ti ringrazio molto... speriamo di riuscirci a fare qualcosa anche perchè per il momento se capisco questo, vado avanti abbastanza per i miei primi progetti da realizzare.

SAluti
 

LucaMs

Expert
Licensed User
Longtime User
Eh, in effetti è un po' come "ricominciare"; qualunque cosa nuova è... nuova, hehehe.
Inoltre, cose semplici come trascinare una sorgente dati su una griglia, per ora ancora non c'è (ma se m'inc... incaponisco, mi metto a sviluppare qualcosa del genere in VB.Net o B4J e la pubblico!).

"tutto" spiegato bene... non so, dovresti leggere i due manuali di base, soprattutto il Beginner, ma è appunto in inglese. Mi pare che qualcuno abbia fatto una traduzione ma non so se l'ha già pubblicata, ora guardo.

Per la griglia e i dati da RDC... io non ho provato l'esempio (preleva i dati da un server a noi disponibile?).
Posso provare (più tardi) a fare un esempio con dei dati finti, altrimenti.

Oh, se qualcuno ha già pronto qualcosa per Pisinho... non è che questa sia una discussione privata, eh!
 

LucaMs

Expert
Licensed User
Longtime User
Ti allego anche un esempio.

Non è un granché, perché, come vedrai, crea una tabella Customer e se ruoti lo smartphone, elimina i dati e li ricrea, l'ho fatto piuttosto in fretta.

Utilizza un database SQLite sul PC, anziché un vero server DBMS on line, ma per il tuo scopo, per avere un esempio di come caricare una grid, va bene.

Devi creare un db SQLite vuoto di nome "test.db" nella cartella Temp del disco di avvio del pc (C:\temp).
Se è necessario, dovrai cambiare l'URL del "server" SQLite nel codice:
B4X:
' TODO: change to your RDC server URL
Private RDCServerURL As String = "http://192.168.1.2:17178"

Allego anche il file config.properties che contiene le query.

Dovrai utilizzare il driver adatto a SQLite, ovviamente. Lo trovi qui.

Qui c'è anche un tutorial di Erel.
 

Attachments

  • LM RDC Example.zip
    26.1 KB · Views: 897
  • config.zip
    748 bytes · Views: 714

tdocs2

Well-Known Member
Licensed User
Longtime User
Ciao, Luca.

Great sub: Sub LoadRDCResult. Grazie mille.

I assume you added it to the Flexible Table class for your own use in the app attached to your posting? That is what I plan to do.

I want my app to be single user (one Android device that contains the DB) and multi user (a "server - PC" that contains the DB and one or more Android devices that use RDC).

Question:

Do I need two identical sets of DB requests - the single user via local SQL commands and the multiuser using RDC commands?

Best regards.

Sandy
 

LucaMs

Expert
Licensed User
Longtime User
Do I need two identical sets of DB requests - the single user via local SQL commands and the multiuser using RDC commands?

I do not know exactly what you should do; usually, the best strategy is to use stored procedures in the database server.

In this case, talking about the SQLite as a "server", you should create all the queries in the config.properties file.
 

tdocs2

Well-Known Member
Licensed User
Longtime User
Grazie, Luca.

In this case, talking about the SQLite as a "server", you should create all the queries in the config.properties file.

I understand. That is exactly what I plan to do (and the only thing I can do) for a multiuser version.

I want the same app targeted to a user who just has an Android device where the SQLite data base resides.

Then, I do not see any other solution than to have 2 identical sets of DB requests in the app - one using RDC and the other one for direct SQL.

Comment?

Best regards.

Sandy
 

LucaMs

Expert
Licensed User
Longtime User
Maybe my English does not make me understand.

Do you want to develop a client/server system, then using some queries, and would you like also create stand-alone app without server?

If the two databases have the same structure and the same purpose, you will have the same queries on the server side in the config.properties file and in a code module in the stand-alone app.

Is perhaps the goal the synchronization between local db with the db server side? In this case the considerations to do are many and complex.
 

tdocs2

Well-Known Member
Licensed User
Longtime User
Luca,

Your English is eccellente, and I am grateful to you for your counsel.

1. My app is to be provided to many distinct business entities, for example, small accounting firms.
2. Some entities or firms will want a multiuser solution while others a single user solution of the app.
3. The SQLite data base is the same format for both the single user as well as the multiuser.
4. The functionality of the app is the same for single user or multiuser.
5. The app will be Android based.

SINGLE USER
The app and the SQLite data base reside on a single Android device. To query and update the data base, the app issues SQL calls.
MULTIUSER
The data base is SQLite and resides on a "server", e.g., a PC running Windows. The app resides in one or more client Android devices. To query and update the data base, the app must use RDC.

I cannot see an alternative other than to have 2 identical sets of data base calls in the app, one SQL based and the other RDC based.

I am asking if there is a more effective solution to achieve the results rather than to have 2 identical sets of data base calls.

Thank you, Luca.

Sandy
 

Straker

Active Member
Licensed User
Longtime User
Probably you can set up a main SqLite db on an internet server and then use local sqLite on the devices, connecting everything with a replica.
I've done something similar for an old app (laptops + mySql) and probably you can do something similar with SQLite.
Search "SQLlite replication" in google.

(Strange, I thought it was the Italian Forum...:D)
 

tdocs2

Well-Known Member
Licensed User
Longtime User
Grazie, Straker.

I apologize - my Italian is very poor. The app that Luca put up is only in the Italian forum. (I could have used Google Translate but it does not always provide the correct translation.)

I want a single data base like client server relationship; thus, RDC...

Best regards.

Sandy
 
Top