1. Paul Shue
  2. PowerBuilder
  3. Thursday, 22 February 2024 22:59 PM UTC

I have a nested dw (dw_data) which has a subreport dw_1. I want to copy all the data from the nested dw (dw_1) to another datawindow (dw_fake) since I cannot do a saveas on anything but the parent. I tried to loop thru parent and use rowscopy but that does not work. Is there a better way to do it? If I cannot use rowscopy I am getting the dw_1 data for each row in the parent in the loop into an any array la_any so after the first iteration of the loop is there a way to append the subsequent rows nested data to what is already there in dw_fake?  

any la_any[]

//(for dw_data)
For ll_loop = 1 to ll_rowcount 

la_any = dw_data.Object.dw_1[ll_loop].object.data
ll_upperbound = UpperBound(la_any)
IF ll_loop = 1 THEN
   dw_fake.object.data = dw_data.Object.dw_1[ll_loop].object.data
ELSE
   dw_data.Object.dw_1[ll_loop].Rowscopy(1, ll_upperbound, Primary!, dw_fake, dw_fake.Rowcount(), Primary!)
END IF

Berka Frenfert Accepted Answer Pending Moderation
  1. Wednesday, 28 February 2024 06:15 AM UTC
  2. PowerBuilder
  3. # 1

Sometime ago i wanted to change english text to chinese text of nested reports. i faced same kind of issue and someone told me the solution. I could not find the post in my questions list. I guess his name was Rene.

Rowscopy should work if you modify parent's Datawindow.Processing. In your script  keep the orignal processing saved so that new  processing can be reverted back to  original.

Lets say your new processing for the parent is 5
dwParent.Modify("Datawindow.Processing=5")

Assume source is dwc1 (the dw_1 in parent) and target is dwc2(dw_2 in parent).

DatawindowChild dwc1, dwc2

dwParent.GetChild("dw_1", dwc1)
dwParent.GetChild("dw_2", dwc2)
dwc2.Reset()
dwc1.RowsCopy(1, dwc1.RowCount(), Primary!, dwc2, 1, Primary!)

/// dont forget to revert the Processing and check return values too :-)

 

 

Comment
There are no comments made yet.
Paul Shue Accepted Answer Pending Moderation
  1. Tuesday, 27 February 2024 16:42 PM UTC
  2. PowerBuilder
  3. # 2

Thanks for your response. I was able to get the first row nested data into a datawindow (dw_fake) as noted in the code above. However any subsequent rows data did not work with rowscopy so how do you append each additional nested data (obtained via dw_data.Object.dw_1[ll_loop].object.data) to dw_fake. I am getting  dw_data.Object.dw_1[1].object.data for the first row and setting it to  dw_fake.object.data. How do I get the second rows nested data (dw_data.Object.dw_1[2].object.data and append that to what is already in dw_fake (1st rows nested data)?

Comment
There are no comments made yet.
Berka Frenfert Accepted Answer Pending Moderation
  1. Tuesday, 27 February 2024 14:54 PM UTC
  2. PowerBuilder
  3. # 3

if dataobject is same then simple DWtarget.object.data = DWSource.object.data should work fine.

for nested reports i remember i had to change presentation style of the nested report to change its attributes. later reverted nested report's presentation style.

dataobject does not have to be same but internal structure like number of columns, their types and sequence should be same. dataobect name can be different for both taget and source dw.

 

i'll try to get the sample code for you tomorrow

My apologies: presentation style of the parent dw is supposed to change and not for the nested child dw.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.