1. Martin Holodniok
  2. PowerBuilder
  3. Wednesday, 13 May 2020 14:06 PM UTC

Hi,

I can't find any way how to import JSON data to nested DataWindow report. Is here anyone who knows how to do it? I can import data to the main DataWindow, but I can't find out any way how to import it to the nested one. It just stays empty now. 

 

Thanks in advance

Martin

Olan Knight Accepted Answer Pending Moderation
  1. Saturday, 16 May 2020 18:38 PM UTC
  2. PowerBuilder
  3. # 1

This is a new one on me.
I know that setting processing to 0 or 1 gives you a grid or a tabular DW.

What does setting the processing to 5 accomplish?


Thank You,

Olan

Comment
  1. Miguel Leeuwe
  2. Monday, 18 May 2020 16:03 PM UTC
YW John, I figured this out when I had to drill down all objects on a window, userobject / tab, tabpage, datawindow, etc. to apply language translations depending on a database table and tags added to dw columns.
  1. Helpful
  1. Miguel Leeuwe
  2. Monday, 18 May 2020 16:05 PM UTC
What I haven't checked is what Ronnie Po said:

"I've been able to work around the getchild() limitation with the following technique:

DWObject ldwo_nested

ldwo_nested = dw_1.object.nested_report"

So that might be another workaround, though not fit for dynamic stuff, like what I had to do to apply translations.
  1. Helpful
  1. Miguel Leeuwe
  2. Monday, 18 May 2020 16:06 PM UTC
I'm not sure, but I think I did an enhancement request some time ago to Appeon, to get rid off this limitation.
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Friday, 15 May 2020 12:54 PM UTC
  2. PowerBuilder
  3. # 2

Does GetFullState/SetFullState work with nested reports? I would try it as it is actually faster than JSON in my testing.

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 13 May 2020 14:59 PM UTC
  2. PowerBuilder
  3. # 3

I don't know what you do to import the json into the datawindow, but you would have to do the same thing for the nested dw.

To get a reference to the nested dw, you can use GetChild().

You might have to temporarily set the processing to 5 for the GetChild to work if you're dealing with nested reports:

 

string ls_restore
datawindowChild ldwc

ls_restore = dw_1.object.datawindow.processing
dw_1.object.processing=5
dw_1.GetChild("name_of_column_with_dddw_or_report", ldwc)
// now you can treat ldwc as if it's a normal dw:
.....
ldwc.Import......

// restore dw_1 to its original type:
dw_1.Modify("Datawindow.Processing=" + ls_restore)

 

Something like that?

 

Comment
  1. Miguel Leeuwe
  2. Friday, 15 May 2020 12:44 PM UTC
Yes, setting the processing to 5 is a little "trick" when dealing with reports/nested datawindows. Don't forget to set it back to what it was like I described using "ls_restore".

GetChild() will give you one same result for all rows.

What is it that you want to do?

Can you export your datawindow(s) so I get an idea of what we're talking about?

regards
  1. Helpful
  1. Martin Holodniok
  2. Thursday, 21 May 2020 08:20 AM UTC
I didn't forget to do that. Thanks :)



Well, I want to do following. I have a DataWindow (lets call it the parent one). Inside this dw, in its detail, there is report (child). In some occasions, there are multiple rows in the parent DataWindow, so there are multiple child reports. I need to import different JSON into each rows report. Is it possible?



regards
  1. Helpful
  1. Miguel Leeuwe
  2. Thursday, 21 May 2020 08:34 AM UTC
YW,

I'm not 100% sure, but I don't thinks it's possible. Whatever you'll import, using the reference obtained with GetChild(), will affect to the report on all of the rows.

Maybe one way around it, would be to import the JSON data for ALL of the rows and then somehow set the rownumber or some other value to an added field on the report. The report would then use that value to filter out all of the JSON imported data, which does not apply to that row of the main dw.

So in the rowfocuschanged of the main dw, you would have to do a GetChild and assign that "rownumber/value" for the filtering to take place.

Still, this way also the other rows would be filtered at that point, but at least it would have the correct data when "working" on a specific row. If you would like to display, print or export this dw, then that solution would be no good at all.



Maybe a better solution is:

Have as much reports as rows you might have. They can all be the same report, but the name of the control on the dw has to be different. Make them all invisible and add this to the expression of visibility of the report:

if (getrow() = currentrow(), 1, 0)

Something like that.

This way, your import of JSON will be specific to a single report control.

regards
  1. Helpful
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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.