RB903 - Code based report - Problem with DBCalc
Hello,
I am using D7 RB903 and a dynamically built report.
I build group bands at runtime and put inside these group bands
db calc following user specified criteria.
User can choose among a list of available fields which field and which
summary operation she likes.
The problem is that only the count operation works.
Every other (sum, average, min, max) not. The result is always zero.
I tried removing the reset group property but with no success.
The relevant snippet code is something like:
var
lTotCalc : TppDBCalc; //TRBILDBCalc;
lLabel : TppLabel;
..
// Create a descriptive label
lLabel := TppLabel.Create(Self);
lLabel.Band := lGroupBand;
lLabel.Left := 0;
lLabel.Top := 0;
lLabel.Text := sTipoCalc + ' per ' + FieldLogicName;
lLabel.Font := Font;
lLabel.Transparent := True;
ListFld.Add(lLabel);
// Create the real dbcalc
lTotCalc := TppDBCalc.Create(Self); //TRBILDBCalc.Create(Self);
lTotCalc.Band := lGroupBand;
lTotCalc.Left := 0;
lTotCalc.Top := 0;
lTotCalc.DataField := FieldName;
lTotCalc.DBCalcType := StringToDbCalcType(sTipoCalc);
lTotCalc.ResetGroup := lGroup;
lTotCalc.Font := Font;
lTotCalc.Transparent := True;
lTotCalc.Autosize := True;
..
Are there any known problems about dbcalc and code generated reports ?
Any tips and/or ideas ?
Thanks in advance
Bye
Nicola
I am using D7 RB903 and a dynamically built report.
I build group bands at runtime and put inside these group bands
db calc following user specified criteria.
User can choose among a list of available fields which field and which
summary operation she likes.
The problem is that only the count operation works.
Every other (sum, average, min, max) not. The result is always zero.
I tried removing the reset group property but with no success.
The relevant snippet code is something like:
var
lTotCalc : TppDBCalc; //TRBILDBCalc;
lLabel : TppLabel;
..
// Create a descriptive label
lLabel := TppLabel.Create(Self);
lLabel.Band := lGroupBand;
lLabel.Left := 0;
lLabel.Top := 0;
lLabel.Text := sTipoCalc + ' per ' + FieldLogicName;
lLabel.Font := Font;
lLabel.Transparent := True;
ListFld.Add(lLabel);
// Create the real dbcalc
lTotCalc := TppDBCalc.Create(Self); //TRBILDBCalc.Create(Self);
lTotCalc.Band := lGroupBand;
lTotCalc.Left := 0;
lTotCalc.Top := 0;
lTotCalc.DataField := FieldName;
lTotCalc.DBCalcType := StringToDbCalcType(sTipoCalc);
lTotCalc.ResetGroup := lGroup;
lTotCalc.Font := Font;
lTotCalc.Transparent := True;
lTotCalc.Autosize := True;
..
Are there any known problems about dbcalc and code generated reports ?
Any tips and/or ideas ?
Thanks in advance
Bye
Nicola
This discussion has been closed.
Comments
You need to assign the TppDBCalc.DataPipeline property as well as the
FieldName property when you are creating data aware components in code.
lTotCalc.DataPipeline := ppReport1.DataPipeline;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Ops!
I forgot that!
It was that, now it works!
Thanks you very much Nico
Best best best regards
Nicola