Label visibility problem in detail band
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
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
This discussion has been closed.
Comments
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;
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com