Page 1 of 1

Example code to populate a datagrid one line at a time

Posted: Tue Dec 29, 2015 12:26 pm
by panosdk
I want to press a button from card1 and add 1 entry (just text) into 3 columns on card2. I know how to write entries on the datagrid but i dont know how to add one, one at a time. If anyone has the time, plz write a simple example.

Re: Example code to populate a datagrid one line at a time

Posted: Tue Dec 29, 2015 2:58 pm
by dunbarx
I always do this in the clear, extracting the contents of a dataGrid, manipulating that data, and restoring. It is possible to do this within the DG itself, I just don't.

Code: Select all

get the dgText of group "yourDataGrid"
put return & "AA" & tab & "BB" & tab & "CC" after it
set the dgText of group "yourDataGrid to it
That sort of thing. This will place that new text in the first three columns of a new row. I find doing it this way is easier for me, since I have complete control, via chunk expressions, of the process.

Craig Newman

Re: Example code to populate a datagrid one line at a time

Posted: Tue Dec 29, 2015 3:10 pm
by panosdk
Yes thats it. Thank you. And one last question. How do i clear the whole datagrid?

Re: Example code to populate a datagrid one line at a time

Posted: Tue Dec 29, 2015 5:20 pm
by dunbarx
Hi.

Same sort of methodology, except you do not need to move data out of the DG itself

Code: Select all

set the dgData of group "yourDataGrid" to ""
or
set the dgText of group "yourDataGrid" to "" 
Craig