Blank When Zero on calc field
Hi,
i'm trying to put a calc field.visible to false if value = 0. but the
calculation is done on the second pass.
it's hard to describe so here is the code.
PROCEDURE DetailAfterGenerate
var
tempJanv : integer;
begin
{ i get totals for each month }
if report.firstpass then
begin
tempJanv := totaljanv;
end
else {I fill values of the fields percentage of each mission
tempon... is calculated in subreport }
begin
PCJanvssmiss.value := temponJanv / tempJanv * 100;
{ Blank when 0 }
if temponJanv = 0 then
PCJanvssmiss.Visible := false
else
PCJanvssmiss.Visible := true;
end;
end;
The probleme is that when i print preview, some values apear and some
other don't. and when i print it on paper, some other values
disappears.
i tried to put the { Blank when 0 } bloc in other events and it
didn't solve the problem.
I hope i have described my problem correctly, and that someone can
help me.
thanks in advance.
i'm trying to put a calc field.visible to false if value = 0. but the
calculation is done on the second pass.
it's hard to describe so here is the code.
PROCEDURE DetailAfterGenerate
var
tempJanv : integer;
begin
{ i get totals for each month }
if report.firstpass then
begin
tempJanv := totaljanv;
end
else {I fill values of the fields percentage of each mission
tempon... is calculated in subreport }
begin
PCJanvssmiss.value := temponJanv / tempJanv * 100;
{ Blank when 0 }
if temponJanv = 0 then
PCJanvssmiss.Visible := false
else
PCJanvssmiss.Visible := true;
end;
end;
The probleme is that when i print preview, some values apear and some
other don't. and when i print it on paper, some other values
disappears.
i tried to put the { Blank when 0 } bloc in other events and it
didn't solve the problem.
I hope i have described my problem correctly, and that someone can
help me.
thanks in advance.
This discussion has been closed.
Comments
"Emmanuel Claus" ha scritto nel messaggio
On Tue, 29 Jun 2004 12:45:33 +0200, "Ernest"
The problem with using an event like the DetailBand.AfterGenerate is that
there is no guarentee that it will only fire once. If you are trying to set
the visibility of a component inside an event other than the
TppVariable.OnCalc event, you will need to do some custom checking whether
the event has been fired for that value or not already. Also, if you are
checking the value of a dbfield perhaps, you may want to use the
DetailBand.BeforePrint instead of the AfterGenerate.
--
Thanks for supporting ReportBuilder! Please vote for ReportBuilder in the
Delphi Informant Readers Choice awards!
http://www.delphizine.com/ballot2004/
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com