Page 1 of 1

DataGrid Adding Data to a Blank Cell in a Row

Posted: Mon Nov 03, 2014 12:30 am
by JereMiami
DataGrid question here:

I simply want to code a button that will add data (e.g., the date & the long time) to a BLANK column in a row that has already been populated (without adding another new row (e.g., AddData)!). How on earth do I do this? Cheers! :roll:

PS: the row that the button will place the data into the columns will ALWAYS be the LAST ROW (so, the numbered row will always be different - aka the last row).

Re: DataGrid Adding Data to a Blank Cell in a Row

Posted: Mon Nov 03, 2014 4:53 pm
by Klaus
Hi Jere,

1. welcome to the forum! :D

2. Will move this thread, since this is NOT a database question, although "Datagrid" also contains "data" 8)

3. OK, herer we go...
You need to get he data from teh last line, add your data (date etc.) and write the "record" back to the datagrid.
Do like this:
a. Get the number of lines of your data in the datagrid, we cannot use the INDEX here,
because the visible last line is not neccessarily the highest INDEX of the datagrid data!
...
put the dgnumberoflines of grp "Your datagrid here..." into tNumOfLines
...
b. Get the array key and data associated with the last line:
...
put the dgdataofline[tNumOfLines] of grp "Your datagrid here..." into tArray
...
c. Now add the data you needd to the correct columns:
...
## Supposed you have these columns in your datagrid
put the data into tArray["date"]
put the time into tArray["time"]
...
d. Now write the data back into the correct line:
...
set the dgdataofline[tNumOfLines] of grp "Your datagrid here..." to tArray
...

That's it, basically :D

Get more info and the docs for datagris here:
http://lessons.runrev.com/m/datagrid



Best

Klaus

Re: DataGrid Adding Data to a Blank Cell in a Row

Posted: Sat Nov 22, 2014 3:38 pm
by JereMiami
Klaus,

I want to thank you so much. This worked perfectly! :D