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

Hide a ppLabel and ppDBMemo based on content of ppMemo

edited November 2005 in RAP
Hi,

In the details of my report I have a ppLabel and a ppDBMemo.
When the content of the ppDBMemo is empty then both fields must be hidden
from the report.
If tried this in the OnGetMemo event of the ppDBMemo but it doesn't work.

procedure ppDBMemo1OnGetMemo(Lines: TStrings);
begin
ppLabe1.Visible := (Lines.Text <> '');
ppDBMemo1.Visible := (Lines.Text <> '');
end

What would be the right way to set this up?

Regards,
Stef

Comments

  • edited November 2005
    Hi Stef,

    I would recommend using the Band.BeforePrint event to check the actual
    record in the dataset the DBMemo is connected to. For instance...

    procedure DetailBeforePrint;
    begin
    ppLabel.Visible := Report.DataPipeline['MemoField'] <> '';
    ppDBMemo.Visible := Report.DataPipeline['MemoField'] <> '';
    end;

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2005
    Hello Nico,

    I did implement it as you said, but still no luck.
    Maybe that some more info will help.

    My report is build up in the following way:
    Report1 = TppReport
    plCompany = TppDBPipeline
    plCustomers = TppDBPipeline

    Report1.DataPipeline = plCompany
    In the Detailarea all fields from plCompany are added.
    The Memo1-field that I want to hide (if blank) belongs to plCompany and is
    also on the Detailarea (same go's for the label).

    On the Detailarea of Report1 there is a TppSubReport added (=SubReport1)
    SubReport1.DataPipeline = plCustomers
    SubReport1 is positioned relatively to the Memo1-field (ShiftRelativeTo)

    I load the report from file (*.rtm) on Form's onShow-event.

    If any other info is needed please ask.

    Regards,
    Stef
  • edited November 2005
    Hi Stef,

    My first suggestion would be to get this working in Delphi, then try to move
    it to RAP. This way you can debug the event code and find out where the
    problem is. In my testing with a very similar setup, the method I mentioned
    in my previous post seemed to work correctly.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2005
    It's solved. Made some mistake in declaration.
    Thanks for the help.
    Stef
This discussion has been closed.