Home End User
New Blog Posts: Merging Reports - Part 1 and Part 2

Can't make subreport work with NoDataBehaviors = [ndBlankReport] property normally...

edited November 2003 in End User
Hi,
My reports are stored in the Oracle 9.2 Database. I access them through
ReportManager component.
I have a problem - I can't make a section style subreport show blank report
when there is no data. All I get is a blank page instead of a blank
subreport.
I have a main report which shows the blank report all right, but whatever I
tried, I couldn't make subreport show blank report.
I tried (have) the following:
1.)My report component has "NoDataBehaviors" property set to "ndBlankReport"
value.
2.)I have the following string at the end of TppReport.Template.OnLoadStart
event :

TppReport(TppReportTemplate(Sender).Report).NoDataBehaviors:=[ndBlankReport]
;
3.)I even tried to go into the source of the report template (in the
"template" field of the "rb_item" table) and tried to set this property
manually:
I put the following string:
NoDataBehaviors = [ndBlankReport]
between those 2:
DataPipeline = ppl_SubReportBody
PrinterSetup.BinName = 'Default'

Still nothing works. My main report shows normally when there is no dat but
the subreport at the end of the main report always shows blank page if there
is no data.

Do you have any ideas how can I make the subreport show blank report instead
of the blank page?

Thank you,
MB

Comments

  • edited November 2003

    Rather than Report.Template.OnLoadStart try using OnLoadEnd.

    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2003
    Nope, that doesn't help.
    It seems that the problem is that TppSubReport class doesn't have
    NoDataBehaviours property, so it can't react to it's changes accordingly.
    But what do I do in this case? Do you have any more ideas?

    Thank you
    MB.

  • edited November 2003

    The TppSubReport.Report property provides access to the TppChildReport
    object. TppChildReport has the NoDataBehaviors property. You can see this at
    design-time by placing a subreport on a main report and then accessing the
    workspace for the subreport. This causes the ChildReport to become selected
    in the object inspector.

    More details....

    A subreport is comprised of two objects:

    1. SubReport control
    The subreport control is added to a band of the
    'parent' report. It has properties such as
    ShiftRelativeTo, PrintBehavior, etc.
    In the Report Designer, the subreport is drawn
    as a rectangle.


    2. ChildReport
    The child report is a descendant of CustomReport and has
    most of the same properties as a standard Report.
    The child report has a separate layout workspace in the report
    designer that is accessible by selecting the tabs at the bottom
    of the designer.






    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2003
    Well, thank you for the information.
    Setting "NoDataBehaviors = [ndBlankReport]" property in the source of the
    subreport at the ChildReport manually really does the trick, but how do I do
    it programmatically? So that I wouldn't have to go in report src all every
    time I want subreport to appear normally?

    This string:

    TppReport(TppReportTemplate(Sender).Report).NoDataBehaviors:=[ndBlankReport]
    in the OnReportLoadEnd event doesn't seem to affect this ChildReport class.

    Thank you,
    MB.

  • edited November 2003

    In the Report.Template.OnLoadEnd event, the Sender is the TppReport object -
    not a subreport.

    Try using Report.GetSubReports. From the RBuilder.hlp....

    ---

    procedure GetSubReports(aReportList: TStrings);

    Description

    Returns a list of handles to all of the TppChildReport objects within a
    report in the Objects property of the TStrings. The Caption of the
    TppSubReport component is saved in the main property of the TString.

    --

    I did not compile this code, but here is an example:

    uses
    ppClass, ppReport;

    var
    lSubReports: TStringList;
    lChildReport: TppChildReport;
    liIndex: Integer;

    begin

    lSubReports := TStringList.Create;

    try

    myReport.GetSubreports(lSubReports);

    for liIndex := 0 to lSubReports.Count-1 do
    begin
    lChildReport := TppChildReport(lSubReports.Objects[liIndex];
    lChildReport.NoDataBehaviors := :=[ndBlankReport];

    end;

    finally

    lSubReports.Free;
    end;

    end;



    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2003
    Thank you very much, that works great !!!

    MB.

This discussion has been closed.