Home RAP

Setting Detail Visible in Before Generate Event

edited August 2009 in RAP
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

Comments

This discussion has been closed.