0

Change text in subreport

Nov 18, 2016 at 11:17 AM

123

avatar image

PowerBuilder 12.5 Win32

I have a tabular datawindow with sub report control named "sub_report". Inside the sub report I have a text control named t_city.

I use

DataWIndowChild dwc

dw_1.GetChild("sub_report", dwc)

dwc.Modify("t_city.text='" + ls_city + "'")

but the label does not change. Is this because aa different subreport exists for every row?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Brad Mettee Nov 18, 2016 at 02:17 PM
0

You can also create an extra parameter for the sub-report and send in the city name (you will need to include it in the select of the container report), then use a computed field to show the argument variable.

Share
10 |10000 characters needed characters left characters exceeded
René Ullrich Nov 18, 2016 at 01:01 PM
0

Yes, you can't use getChild for nested reports because there is a different subreport for each row.

But you may use the dot notation to access a report for a specific row.

dw_control.object.dw_nested[ll_row].object.t_city.text="your text"

Try

dw_control.object.dw_nested.object.t_city.text="your text"

to change the text for all rows. (I don't know if it is possible.)

Share
10 |10000 characters needed characters left characters exceeded
Valdas Vaitiekaitis Dec 07, 2016 at 09:47 AM
0

Last time I tried to do this it worked only for composite reports but only if sub report is not composite and does not have sub reports of its own, quoting official documentation:

You cannot use GetChild to get a reference to a report in a composite DataWindow when the report itself is a composite or nested DataWindow.

So Your best call is, as suggested by Brad Mettee above, to pass the stuff You need as parameters, but You do not necessary have to include it in the SQL query, for example Your t_city can be declared in main report as invisible, and for sub report parameters it's value can be retrieved using Describe method:

Describe("t_city.Text")

Or just store it in computed field and access its value directly.

However You would need to recall Retrieve() every time You modify the t_city for changes to reflect in appropriate sub reports.

Share
10 |10000 characters needed characters left characters exceeded
Skip to Content