Page 1 of 1
How to insert a data in a data grid from other substack
Posted: Thu Feb 28, 2019 2:51 pm
by lemodizon
hello everyone i just want to ask what is the script if i want to transfer the data from the fields in my substack to the main stack of the datagrid. thanks in advance

Re: How to insert a data in a data grid from other substack
Posted: Thu Feb 28, 2019 2:56 pm
by dunbarx
Hi.
You can collect the entirety of the contents of a DG using either the "dgData" or the "dgText". This gives either an array or a tab/return delimited dataSet.
Going the other way, if you format your field data with tabs and returns, just as if you wanted to paste into an Excel spreadsheet, and set the "dgData" of the dataGrid to that dataSet, the information will appear by magic.
Craig Newman
Re: How to insert a data in a data grid from other substack
Posted: Thu Feb 28, 2019 3:59 pm
by Klaus
Hi Lemuel,
looks like you have a datagrid of typ TABLE, right?
Then you can modify -> the dgtext of grp "your datagrid here"
which is nothing but TAB and CR delimited text!
Do this, you may need to add ->
of cd XYZ of stack XZY in the script,
depending where you put the script:
Code: Select all
...
## Collect the data in stack "Substack"
put fld "ID Number" & TAB & fld "Real Name" & TAB & fld "AGE" into tNewData
## Check if datagrid already has content:
put the dgtext of grp "your datagrid here" into tOldData
## New and first entry:
if tOldData = EMPTY then
put tNewData into tOldData
else
## We ADD the data
put CR & tNewData after tOldData
end if
## Now set the new data:
set the dgtext of grp "your datagrid here" to tOldData
...
Best
Klaus
Re: How to insert a data in a data grid from other substack
Posted: Tue Mar 05, 2019 4:53 am
by lemodizon
Hello Klaus,
I tried your code there is error i think i did something wrong or i missed a script.
where will i put this: of cd XYZ of stack XZY in the script,
depending where you put the script:
Thanks Klaus
Re: How to insert a data in a data grid from other substack
Posted: Tue Mar 05, 2019 10:56 am
by Klaus
What is the exact "address" of the datagrid?
LC needs to know, just like the postman!
...
put the dgtext of grp "your datagrid here" OF CD "xyz" OF STACK "your stack here" into tOldData
...
Re: How to insert a data in a data grid from other substack
Posted: Thu Mar 07, 2019 9:51 am
by lemodizon
Klaus,
Thanks again this is now working. here is the script i created.