Setting Detail Visible in Before Generate Event
Using Report Builder 11.05 b3 (Delphi 2007).
In my Delphi applications, I have code in the BeforeGenerate event to
stop the detail band from printing for specified rows. As an example -
Delphi Application
------------------
rbDetail1.Visible :=
not ((rbRichTextAnalysis1.RichText = '') and
(rbRichTextAnalysis2.RichText = ''));
When converting to RAP, I get different results.
RAP Code
--------
Report.Detail.Visible :=
not((RichText1.RichText = '') and (RichText2.RichText = ''));
I can reproduce this with the RAP demonstration application. Using
Example 12 (Setting the Font Color for +/-).
procedure DetailBeforeGenerate;
begin
{ Report.Detail.Visible := false; } {Line 1}
if plStock['PRICE_CHG'] > 0 then
DBText2.Font.Color := clBlack
else
DBText2.Font.Color := clRed;
{ Report.Detail.Visible := (plStock['PRICE_CHG'] > 0); } {Line 2}
{ Report.Detail.Visible := not (plStock['PRICE_CHG'] > 0); } {Line 3}
end;
With line 1 included
--------------------
Report.Detail.Visible := false;
The first item is reported.
SMC, BUY, 39
With line 2 included
--------------------
Report.Detail.Visible := (plStock['PRICE_CHG'] > 0);
I get 6 lines reported.
SMC,BUY, 39
TC, BUY, 18
HS, HOLD,11
DHB,SELL,32
HGJ,SELL, 5
PIN,SELL,-4 (in red)
With line 3 included
--------------------
Report.Detail.Visible := not (plStock['PRICE_CHG'] > 0);
I get only the first item reported.
SMC, BUY, 39
Richard Harding
In my Delphi applications, I have code in the BeforeGenerate event to
stop the detail band from printing for specified rows. As an example -
Delphi Application
------------------
rbDetail1.Visible :=
not ((rbRichTextAnalysis1.RichText = '') and
(rbRichTextAnalysis2.RichText = ''));
When converting to RAP, I get different results.
RAP Code
--------
Report.Detail.Visible :=
not((RichText1.RichText = '') and (RichText2.RichText = ''));
I can reproduce this with the RAP demonstration application. Using
Example 12 (Setting the Font Color for +/-).
procedure DetailBeforeGenerate;
begin
{ Report.Detail.Visible := false; } {Line 1}
if plStock['PRICE_CHG'] > 0 then
DBText2.Font.Color := clBlack
else
DBText2.Font.Color := clRed;
{ Report.Detail.Visible := (plStock['PRICE_CHG'] > 0); } {Line 2}
{ Report.Detail.Visible := not (plStock['PRICE_CHG'] > 0); } {Line 3}
end;
With line 1 included
--------------------
Report.Detail.Visible := false;
The first item is reported.
SMC, BUY, 39
With line 2 included
--------------------
Report.Detail.Visible := (plStock['PRICE_CHG'] > 0);
I get 6 lines reported.
SMC,BUY, 39
TC, BUY, 18
HS, HOLD,11
DHB,SELL,32
HGJ,SELL, 5
PIN,SELL,-4 (in red)
With line 3 included
--------------------
Report.Detail.Visible := not (plStock['PRICE_CHG'] > 0);
I get only the first item reported.
SMC, BUY, 39
Richard Harding
This discussion has been closed.
Comments
Sorry for the delay in this response.
Try moving your code to the BeforePrint event and see if that helps. It
seems hiding the detail band from the BeforeGenerate is causing the issue.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Yes, that solved the problem. Thank you.
Richard Harding.