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

Label visibility problem in detail band

edited November 2003 in General
Hi,

I have a report in which I need to change the visibility of some labels in
the detail band depending on the nature of the record being printed.
However, doing this in the details band's BeforePrint event causes changes
the visibility in *all* the details bands (i.e. those already printed for
previous records). I've got round this by setting the report to psOnePass
and setting CachePages to true, but this means that I can't determine the
total number of pages when printing or previewing as I would be able to
using psTwoPass.

Is there another way of changing a label's visibility *without* affecting
instances of that label in previous detail bands?

(I'm using RB 4.23 with Delphi 3.)

TIA

John

Comments

  • edited November 2003
    Hi John,

    In my testing, the DetailBand.BeforPrint event seemed to be the best choice
    for this task. I was able to get this working with the Report.PassSetting
    set to TwoPass. Below is a snip of code I used to accomplish this.

    procedure TForm1.ppDetailBand1BeforePrint(Sender: TObject);
    var
    liCustNo: Integer;
    begin

    liCustNo := ppReport1.DataPipeline['CustNo'];

    if liCustNo < 2000 then
    ppLabel1.Visible := False
    else
    ppLabel1.Visible := True;
    end;

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2003
    "Nico Cizik (Digital Metaphors)" wrote in
This discussion has been closed.