V4RB: Question to SUM

Claudius Sailer Claudius at sailer-online.de
Fri Jun 6 22:46:13 CDT 2003


Hi,

I am testing the following Code. A long Time ago, when SUM was first 
installed I got the information that SUM is much slower for few records 
than doing the same with a Routine in RB. Now I compared both and I 
think this not longer true. Could someone confirm that?

An other question is. Is it possible to make the last row more 
effectiv? What is the result of SUM? a floatField?

   SQLString="SELECT SUM(Betrag)"
   SQLString=SQLString+" FROM Buchungen"
   SQLString=SQLString+ " WHERE Herk_Konto= "+KontoRecID
   if NOT CheckLeer(Startdatum) then
     SQLString=SQLString+ " AND BDatum>'"+StartDatum+"'"
   end if
   if NOT checkLeer(Enddatum) then
     SQLString=SQLString+ " AND BDatum<='"+Enddatum+"'"
   end if

   CurBuchungen=meineDatenbank.SQLselect(SQLString)
   Ende=CurBuchungen.RecordCount
   'field1=CurBuchungen.longfield(2) //Betrag
   'for ii=1 to Ende
   CurBuchungen.CurrentPosition=1
   KontoStand=val(CurBuchungen.StringField(1).getString)



This row crashed RB ;-)) How does it have to look right? KontoStand is 
integer and the result is also an integer.

   KontoStand=CurBuchungen.FloatField(1).value

Thanks


Claudius



More information about the Valentina mailing list