cancel
Showing results for 
Search instead for 
Did you mean: 

Change text in subreport

Former Member
0 Kudos

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?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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.

Answers (2)

Answers (2)

cigaras
Explorer
0 Kudos

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.

Former Member
0 Kudos

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.)