Page 1 of 1

Problem copying from DG1 to DG5

Posted: Thu Feb 15, 2024 12:53 pm
by CAsba
Hi all,
I'm using the following code but without success. Any ideas why ?

Code: Select all

put the dgNumberOfLines of grp "datagrid 1" into tLines
   set the dgHilitedLines of grp "datagrid 1" to tLines
   put the dgHilitedLines of group "datagrid 1" into theLine#hilite the last line
   put the dgDataOfLine[theLine] of group "datagrid 1" into theDataA 
   put theDataA into fld "arraydata2"#to ensure data has been actioned(copied)  - NOT copied
   put false into firstLineContainsColumnNames
   dispatch "addline" to grp "datagrid 5" with theDataA

Re: Problem copying from DG1 to DG5

Posted: Thu Feb 15, 2024 1:35 pm
by Klaus
Hi CAsba,

Code: Select all

...
put the dgNumberOfLines of grp "datagrid 1" into tLines
set the dgHilitedLines of grp "datagrid 1" to tLines
put the dgHilitedLines of group "datagrid 1" into theLine
...
after this -> tLines = tLine
So you could save one variable, but does not hurt of course!

Code: Select all

...
put the dgDataOfLine[theLine] of group "datagrid 1" into theDataA 
put theDataA into fld "arraydata2"
...
theDataA is also an ARRAY, so you cannot put this into a field!

Code: Select all

dispatch "addline" to grp "datagrid 5" with theDataA
ADDLINE does NOT exspect an array as parameter, see the dictonary!
Try this instead:

Code: Select all

...
## This is the default, so no need to set it:
## put false into firstLineContainsColumnNames
## dispatch "addline" to grp "datagrid 5" with theDataA

## Will add the data at the end of the other DG:
dispatch "addData" to grp "datagrid 5" with theDataA
...
Best

Klaus

P.S.
If something does not work as exspected, it is not a bad idea to look up the used command(s) in the dictionary! 8)

Re: Problem copying from DG1 to DG5

Posted: Thu Feb 15, 2024 4:12 pm
by CAsba
Hi Klaus,
Thank you so much !
I took a look at the dictionary, but without knowing that there is a 'AddData' command, I don't know how I could have found it.
Anyway, I'm back on track, thanks to your much appreciated assistance.

Re: Problem copying from DG1 to DG5

Posted: Thu Feb 15, 2024 4:23 pm
by Klaus
Yes, get it, I meant to look at a command like "addline" here to check why it does not work as exspected.