[TRUCO DELPHI] Sumando multiples filas seleccionadas de un DBGrid.
delphi
function SUMSomething: Float; var i: Integer; Sum: Currency; begin Sum := 0; for i := 1 to DBGrid1.SelectedRows.Count do begin Table1.GotoBookMark (Pointer(DBGrid1.SelectedRows.Items[i-1])); Sum := Sum + Table1.FieldByName('AField').AsFloat; end; Result := Sum; qend;
Saludos!