Link to home
Start Free TrialLog in
Avatar of cvince
cvince

asked on

How couldt I share data between a DS report and a datawindow control ??

Hi,

I have a composite datastore report (lds_1) in it contains several datawindows.
I now need to share lds_1 with dw_1 (for preview) by doing

lds_1.sharedata(dw_1)

The result is an empty dw2. Does anybody know what is wrong?

Thanks
CVince
Avatar of EAServer
EAServer

I've never tried ShareData with a composite datawindow, but I don't think that it would work.  Sharedata basically shares the primary buffer of two datawindows.  Composite datawindows don't really have a primary buffer.
Besides, sharedata is going to be limited in this context, because and Modify() functions you applied to the source datawindow won't be shared with the secondary datawindow since it shares the data only and no formatting.


Instead, use GetFullState/SetFullState to basically make a copy of your datastore

blob lblb_data

lds_1.GetFullState(lblb_data)
dw_1.SetFullState(lblb_data)
Hi
Try creating a child datawindow using the getchild() function for the childdatawindow in the datastore from which u want to share the data, then try sharing the data , i have not tried it , but it should work !!!.

best regards
Gokul Kalpathi
Gokul
Yep that works, don't know why I didn't think of it earlier, I've had to do this in the past with nested datawindows, but not composite.  But I'd still probably use the fullstate methods as that will carry formatting changes as well as the data.

Avatar of cvince

ASKER

I tried this :

datawindowchild child1, child2

lds_1.getChild ("dw_data1", child1)
lds_1.getChild ("dw_data2", child2)
...

dw_1.getChild ("dw_data1", child3)
dw_1.getChild ("dw_data2", child4)
...

child1.sharedata (child3)
child2.sharedata (child4)
...

But it doesn't work !!...


I noticed that if i've a composite datastore and i tried to share it whith 2 other dw, sharing was ok. But with another composite, it seems to be impossible !
ASKER CERTIFIED SOLUTION
Avatar of EAServer
EAServer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cvince

ASKER

I tried 3 ways to use sharedata :
Share a DW with a DW in a composite -> OK
Share a DW in a composite with a DW -> Don't work
Share a DW in a composite with another DW in a composite -> Don't work.

Another ways is to use the rowscopy ! It's work !!! ;o)

And getFullState/setFullState works too ! this methods is speeder than other !

PS : the return code for the sharedata in the previous example is -1.

---------------------------------------------

Now I need to do this with a report that contain a regular DW and a DW OLE object (Graphique Microsoft Graph 2000).

All the DW are copied from the reports 1 to the reports 2, but the graph does not appear in the second report !!! Just in the first !!!

dataWindowChild     child_1, child_2, child_3, child_4, ldwc_Graph
int     li_rc

// DW...
dw_1.dataObject = "d_report_graph"
dw_2.dataObject = "d_report_graph2"

li_rc = dw_1.setTransObject (SQLCA)
li_rc = dw_1.retrieve ()

// Graph construction...
li_rc = dw_1.GetChild('dw_graph', ldwc_Graph)

ldwc_Graph.Reset()

ldwc_Graph.InsertRow(0)
ldwc_Graph.SetItem(1,"serie","")
ldwc_Graph.SetItem(1,"cat1","ABC")
ldwc_Graph.SetItem(1,"cat2","ABCD")
ldwc_Graph.SetItem(1,"cat3","ABCDE")
ldwc_Graph.SetItem(1,"cat4","ABCDEF")

ldwc_Graph.InsertRow(0)
ldwc_Graph.SetItem(2,"serie","Indice")
ldwc_Graph.SetItem(2,"cat1","103")
ldwc_Graph.SetItem(2,"cat2","100")
ldwc_Graph.SetItem(2,"cat3","102")
ldwc_Graph.SetItem(2,"cat4","96")

dw_1.getChild ("dw_trace", child_1)
dw_1.getChild ("dw_graph", child_2)
dw_2.getChild ("dw_trace", child_3)
dw_2.getChild ("dw_graph", child_4)

child_1.RowsCopy (1, child_1.rowCount (), primary!, child_3, 1, primary! )
child_2.RowsCopy (1, child_2.rowCount (), primary!, child_4, 1, primary! )

All the return code are OK ! But the grahp still not copied...