Einzelnen Beitrag anzeigen

Benutzerbild von Bummi
Bummi

Registriert seit: 15. Jun 2010
Ort: Augsburg Bayern Süddeutschland
3.470 Beiträge
 
Delphi XE3 Enterprise
 
#10

AW: calculating Rows in Table

  Alt 11. Aug 2012, 19:02
Delphi-Quellcode:
function Calculate_(table: TABSTable; Field: string):string;
var
  tpRunTotal: Double;
begin
tpRunTotal := 0;
with Table do
begin
  First;
  while not EOF do
  begin
    tpRunTotal := tpRunTotal + Table.FieldByName(field).AsFloat;
    Next;
  end;
end;
Result := FormatFloat('0.00',tpRunTotal )
end;
but mentioned Query with SUM will be better ...
Thomas Wassermann H₂♂
Das Problem steckt meistens zwischen den Ohren
DRY DRY KISS
H₂ (wenn bei meinen Snipplets nichts anderes angegeben ist Lizenz: WTFPL)
  Mit Zitat antworten Zitat