all data from one datagrid to column i another datagrid?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
tusa
Posts: 36
Joined: Sun Jan 31, 2016 10:30 pm

all data from one datagrid to column i another datagrid?

Post by tusa » Sat Aug 27, 2016 7:20 am

Hello everybody.

I have the attached datagrids as you can se.
When I press a button my different data gets in the sequenze to the right, exept the 2 lines of data in the litlle datagrid.
I use this piece of code:

Code: Select all

   put the dgData of group "tmpldataGrid" into theDataB
   put theDataB["Data"] into tData
   put tData into theDataA["Data"]
I need the 2 lines, or more, if data is written, to be stored ind the column data, seperated with fx. vertical line.

Best regards Tue.
Attachments
Udklip.JPG

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1682
Joined: Sat Feb 28, 2009 11:49 pm

Re: all data from one datagrid to column i another datagrid?

Post by sturgis » Sun Aug 28, 2016 9:07 pm

I'm hoping I understand what you area asking..

When you -- put the dgdata of grp "tmpldatagrid" into thedataB
you end up with an array like this..
thedatab[1]
[column] data
[another column] data
theDataB[2]
[column] data
[another column] data
etc..
So when you -- put thedataB["data"] into tdata
tData will most likely be empty because there is no first level key named "data"

In order to do what I _think_ you want to do, you'll need a repeat loop.. Something like the following.

Code: Select all

put the keys of theDataB into tKeys
repeat for each line tLine in tKeys
-- this assumes the second datagrid has a column named "data" to match the first datagrid
   put theDataB[tLine]["data"] into theDataA[tLine]["data"]
end repeat
This will create a numerically keyed 2 level array with the data you need at which point you can -- set the dgdata of group "myOtherDatagrid" to theDataA

If I'm wrong about what you are trying to accomplish here, my apologies.
tusa wrote:Hello everybody.

I have the attached datagrids as you can se.
When I press a button my different data gets in the sequenze to the right, exept the 2 lines of data in the litlle datagrid.
I use this piece of code:

Code: Select all

   put the dgData of group "tmpldataGrid" into theDataB
   put theDataB["Data"] into tData
   put tData into theDataA["Data"]
I need the 2 lines, or more, if data is written, to be stored ind the column data, seperated with fx. vertical line.

Best regards Tue.

Post Reply

Return to “Talking LiveCode”