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

Set NoDataBehaviors of a subreports.

edited March 2004 in RAP
Hi all,
can i set the NoDataBehaviors of a subreport in the rap environment ?

I have created a Pass-Through function, but when there is no data, the
subreport is never printed .

Thanks in advance.

Massimo.

Comments

  • edited March 2004

    1. If the subreport is traversing the detail pipeline of a master/detail
    relationship then you need to also set the detail datapipeline
    SkipWhenNoRecords property to False. If you are using DADE to link
    DataViews, you can do this by double clicking on the visual link to display
    the link dialog. There is an option at the bottom.

    2. If after trying number 1 above, you still have an issue, then first try
    it in Delphi code. You may need to set the NoDataBehaviors before the report
    starts printing.



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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited March 2004
    Thanks for the answer Nard.

    I have done some checks on SkipWhenNoRecords property and this is correctly
    set to false.

    After this, i I'm not able to set the noDataBehaviors in delphi code,
    becaouse my reports are stored in a database and i load dynamically at
    runt-time.

    In rap i call my Pass-Through function in the beforeprint event of the
    report passing the sub report as:

    Procedure ReportBeforePrint;
    begin
    PrintNoData(subreport1);

    end;

    My Pass-Through have this delphi code:

    procedure TPrintNoData.ExecuteFunction(aParams: TraParamList);
    var
    IntReport : tPpreport;
    begin
    GetParamValue(0, IntReport);

    IntReport.NoDataBehaviors := [ndBlankReport];

    end;

    When i debug the delphi code, the intreport nodatabehaviors is corretly set.

    Do you have some advice to solve this problem ?

    Thanks in advance.

    Massimo.




  • edited March 2004

    My suggestion to create a Delphi code example was an attempt to break down
    the problem into incremental steps. What I meant was to create a simple
    example report using DBDemos and try to implement a simple minimal example
    that set the NoDataBehaviors property of a child report.

    Your RAP pass-through function is not correct. A TppSubreport is not a
    descendant of TppReport.

    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.



    The signature of your pass thru function should look like this:

    procedure PrintNoData(aCustomReport: TppCustomReport);

    The call to the function should look like

    PrintNoData(Subreport.Report);


    Inside the pass-through function you need

    uses
    ppClasss, ppTypes;

    var
    lReport: TppCustomReport;
    begin
    GetParamValue(0, lReport);

    lReport.NoDataBehaviors := [ndBlankReport];

    end;





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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited March 2004
    Thank you very much Nard, I have change my pass-through function following
    your advice and now all works fine.

    Thanks.

    Massimo


This discussion has been closed.