[updated]-data from mainstack --> dg of substack ??

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
shawnblc
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 342
Joined: Fri Jun 01, 2012 11:11 pm

[updated]-data from mainstack --> dg of substack ??

Post by shawnblc » Mon Jun 15, 2015 3:38 pm

I have a datagrid (DataGridFiles1) in a substack. I'm trying to add this data from the main stack to the grid in the substack.
My file is uploading to the server fine, my flds are populating fine, just not able to transfer that data to the datagrid in the substack.

What am I doing wrong?

Here's my code.

Code: Select all

put fld "fldDate" & tab & fld "lblLink" & tab & fld "lblFacility" & tab & the label of button "documentMenu" into theRowData
--put "Date" & cr & "Facility" & cr & "Category" & cr & "Document" into theDataColumns

put the dgNumberOfLines of me +1 into theLineNo
dispatch "AddLine" to group "DataGridFiles1" with theRowData, theDataColumns, theLineNo
Last edited by shawnblc on Wed Jun 17, 2015 12:00 am, edited 1 time in total.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Uploading file from mainstack, put data in dg on substac

Post by dunbarx » Mon Jun 15, 2015 4:04 pm

Hi.

We would need more info about those other handlers, like "addLine".

Craig Newman

shawnblc
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 342
Joined: Fri Jun 01, 2012 11:11 pm

Re: Uploading file from mainstack, put data in dg on substac

Post by shawnblc » Mon Jun 15, 2015 4:10 pm


bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Uploading file from mainstack, put data in dg on substac

Post by bangkok » Mon Jun 15, 2015 4:15 pm

If the DG is on a substack, you have to... say it. Explicitly :)

Code: Select all

dispatch "AddLine" to group "DataGridFiles1" of cd "mycd" of stack "mysubstack" with theRowData, theDataColumns, theLineNo
I see another -potential- problem in your script.

Code: Select all

put the dgNumberOfLines of me +1 into theLineNo
Does it mean that the DG on your substack is like a mirror of the DG on your main stack ? With the same number of lines ?

If not, then your script is wrong. You need to get the dgNumberOfLines not of "me" but of the DG on your substack, before to add a line in the substack.

Like :

Code: Select all

put the dgNumberOfLines of group "DataGridFiles1" of cd "mycd" of stack "mysubstack" into theLineNo
add 1 to theLineNo

shawnblc
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 342
Joined: Fri Jun 01, 2012 11:11 pm

[updated]-data from mainstack --> dg of substack ??

Post by shawnblc » Tue Jun 16, 2015 7:09 pm

Maybe this image will help better understand what I'm trying to accomplish. The datagrid on the right is my substack "Filing Cabinet".

When the upload file button is pushed, I want to populate the datagrid in the substack.

Note: the upload is working perfectly.

Update: Got it now, but when I add to the datagrid a second time, it rewrites line 1 of the dg instead of creating a new line (row).

Post Reply