• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1522
  • Last Modified:

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
0
cvince
Asked:
cvince
  • 3
  • 2
1 Solution
 
EAServerCommented:
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)
0
 
gokulrkalpathiCommented:
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
0
 
EAServerCommented:
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.

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
cvinceAuthor Commented:
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 !
0
 
EAServerCommented:
Have you tried the get/setfullstate functions?  I'd recommend this method with print previews anyhow because you'll want to retain any changes in formatting.  I realize in your situation of having a composite in a datastore that dynamic formatting probably isn't an issue, but I think it is worth trying.

Typically I create a standard print preview window to display all reports in a print preview mode by simply opening it with parm and passing the blob from a getfullstate, then I can reuse my window throughout my entire application.

Your sharedata logic looks good, what return value do you get from your sharedata funtion?

0
 
cvinceAuthor Commented:
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...



0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now