Using variable
Hi.
I've a problem with the TppVariable component that seem to work well
with RB 9.02 on Delphi 7 but it doesn't with DB 10.06 with Delphi 2007.
I built a simple test with the DBDemos database and the employee table.
I put a TDatabase, TTable, TDataSource, TppDBPipeline, TppReport and I
joined all toghether. Then I opened the RB designer I put 2 TppDBText
with two field and a TppVariable in the detail band. Then I wrote this
code in the onCalc event handler of the TppVariable:
procedure TForm1.ppVariable1Calc(Sender: TObject; var Value: Variant);
begin
if VarToStr(Value) = '' then
Value := 0;
Value := StrToInt(Value) + 1;
end;
The problem is that the first value I see on the variable is 2 instead
of 1. It seems that the event is fired two times for the first record.
Thanks in advance.
Luca Minuti.
I've a problem with the TppVariable component that seem to work well
with RB 9.02 on Delphi 7 but it doesn't with DB 10.06 with Delphi 2007.
I built a simple test with the DBDemos database and the employee table.
I put a TDatabase, TTable, TDataSource, TppDBPipeline, TppReport and I
joined all toghether. Then I opened the RB designer I put 2 TppDBText
with two field and a TppVariable in the detail band. Then I wrote this
code in the onCalc event handler of the TppVariable:
procedure TForm1.ppVariable1Calc(Sender: TObject; var Value: Variant);
begin
if VarToStr(Value) = '' then
Value := 0;
Value := StrToInt(Value) + 1;
end;
The problem is that the first value I see on the variable is 2 instead
of 1. It seems that the event is fired two times for the first record.
Thanks in advance.
Luca Minuti.
This discussion has been closed.
Comments
If possible, please send this example to support@digital-metaphors.com in
.zip format and I'll take a look at it for you.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Done.
Thanks,
Luca Minuti.
only this week.
My work around, Luca, was to put the code that adds to the variable inside
the DBText's OnPrint event that only appears to fire once.
Jason.
values, not perform calculations. If you need to perform a calculation, be
sure to use a numerical type.
From our email correspondence....
---
Upon further research, I found that we had purposefully changed the way
String variables interact. This was due to the fact that String Variables
were not properly being cached across page breaks. What exactly are you
trying to accomplish? Would it be possible to change the type of the
variable in your report to a numerical type (integer, double, etc)?
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com