Save grid array

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

Post Reply
chrisjx2002
Posts: 168
Joined: Wed Jan 06, 2010 5:39 pm
Been thanked: 2 times

Save grid array

Post by chrisjx2002 » Tue Mar 10, 2015 6:01 pm

Hi Everybody,

I try to use grid instead of browse. I have a simple problem : the save function does not seem to work when using an array as ITEMS.

I define a Grid_1 in a Form_1 with an array aTest as ITEMS. I use EDIT to modify the values. It works on the screen. But when I try to save the new values with the save option : Form_1.Grid_1.save it does not modified the array aTest. I miss certainly something but I don't know what. Any help will be appeciated.

User avatar
srvet_claudio
Posts: 2044
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 35 times
Been thanked: 146 times
Contact:

Post by srvet_claudio » Tue Mar 10, 2015 6:20 pm

chrisjx2002 wrote:Hi Everybody,

I try to use grid instead of browse. I have a simple problem : the save function does not seem to work when using an array as ITEMS.

I define a Grid_1 in a Form_1 with an array aTest as ITEMS. I use EDIT to modify the values. It works on the screen. But when I try to save the new values with the save option : Form_1.Grid_1.save it does not modified the array aTest. I miss certainly something but I don't know what. Any help will be appeciated.
EDIT option only work with database

Code: Select all

aData := Array (Form_1.Grid_1.ItemCount, Form_1.Grid_1.ColumnCount)
For i:= 1 TO Form_1.Grid_1.ItemCount
	For j:= 1 TO Form_1.Grid_1.ColumnCount
	   aData [i,j] := Form_1.Grid_1.Cell (i,j) 
	Next
Next
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com

User avatar
andyglezl
Posts: 1142
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 35 times
Been thanked: 68 times
Contact:

Post by andyglezl » Tue Mar 10, 2015 6:30 pm

Hola chrisjx2002
...It works on the screen...
Por lo tanto solo tienes que tomar el renglon modificado:
MSGDEBUG( Form_1.Grid_1.Item( Form_1.Grid_1.Value ) )

El array aTest es solo para iniciar el GRID con Informacion.
--------------------------------------------------------------------------
Hello chrisjx2002
...It works on the screen ...
So you just have to take the changed row:
MSGDEBUG( Form_1.Grid_1.Item( Form_1.Grid_1.Value ) )

The aTest array is just to start the GRID with information.
Andrés González López
Desde Guadalajara, Jalisco. México.

chrisjx2002
Posts: 168
Joined: Wed Jan 06, 2010 5:39 pm
Been thanked: 2 times

Post by chrisjx2002 » Tue Mar 10, 2015 7:17 pm

Thanks Claudio for the tip. It works. I think it would be nice to have the save option for array too.

Post Reply