Change text in subreport

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?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Nov 18, 2016 at 02:17 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 18, 2016 at 01:01 PM

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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 07, 2016 at 09:47 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

Skip to Content