All grid values to md array

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
Claudio Ricardo
Posts: 367
Joined: Tue Oct 27, 2020 3:38 am
DBs Used: DBF, MySQL, MariaDB
Location: Bs. As. - Argentina

Re: All grid values to md array

Post by Claudio Ricardo »

Thank you very much Jimmy, Salinetas and Franco !!! I'll try your solutions tomorrow.
Muchas gracias Jimmy, Salinetas y Franco !!! Mañana pruebo sus soluciones.

Jimmy, since almost always the data to load in the grid comes from SQL and has a fixed number of columns, I use:

Code: Select all

	DoMethod ("Cortes" , "Grid_1" , "DeleteAllItems")

	If HMG_Len ( aTable ) > 0
		For i := 1 To HMG_Len ( aTable )
			DoMethod ("Cortes" , "Grid_1" , "AddItem" , aTable [i])
		Next
	EndIf
You say that if I use " ITEMS aData " directly instead of my usual routine (shown above) when I edit a cell it will be reflected in the array ?
That would be exactly what I'm needing !!!
Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: All grid values to md array

Post by AUGE_OHR »

hi Claudio,

i do use much "virtual" GRID and "know" that i can change

Code: Select all

   ITEMS aData 
"on-fly" e.g. when change Folder and Display it

but i have not try

Code: Select all

   ALLOWEDIT .T.
to "Edit" new Data this Way (which is HMG Way)
i do "Prompt" each FIELD in a loop to "Edit"

as i say it is need to send

Code: Select all

   SetProperty( "Main", "Grid_1", "ITEMCOUNT", LEN( aData ) )
else you got a "bound Access fail"

---

to use "AddItem" is the "safe" Way
when have a lot of Items i can be need a long Time to "AddItem"

but a SQL Result-Set "is" a Array like Directory() so you "direct" can assign it to GRID
have fun
Jimmy
User avatar
Claudio Ricardo
Posts: 367
Joined: Tue Oct 27, 2020 3:38 am
DBs Used: DBF, MySQL, MariaDB
Location: Bs. As. - Argentina

Re: All grid values to md array

Post by Claudio Ricardo »

Muchisimas gracias a Jimmy, Salinetas, Andy y Franco, gracias a ustedes logré lo que estaba necesitando
y además aprendi varias cosas más sobre el control grid !!! Paso el dummy limpio y funcionando.
Ahora lo puedo incorporar al programa real y ver los reultados con valores reales.

Many thanks to Jimmy, Salinetas, Andy and Franco, thanks to you I got what I needed
and I also learned several more things about the grid control !!! I pass the dummy clean and working.
Now I can incorporate it into the real program and see the results with real values.
Attachments
A_demo_grid_to_array.zip
(1.43 MiB) Downloaded 110 times
Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162
Post Reply