Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

RB903 - Code based report - Problem with DBCalc

edited September 2008 in General
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

Comments

  • edited September 2008
    Hi Nicola,

    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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2008
    Hi Nico,

    Ops!
    I forgot that!
    It was that, now it works!
    Thanks you very much Nico
    Best best best regards
    Nicola

This discussion has been closed.