OK. Here is a solution
procedure TForm1.Calculate;
var
i: integer;
Total: Currency;
begin
Total := 0;
ClientDataSet5.First;
while not ClientDataSet5.EOF do
begin
Total := Total + ClientDataSet5.Field.Fieldname('Money').AsCurrency;
ClientDataSet5.Next;
end;
end;
This will get you started although you will come into accuracies problems
when working with money that also require other methods.
JED
[EMAIL PROTECTED] wrote on 19/07/2003 05:59:14 AM:
> Hi there,
>
> Someone replied to my question but I didn't see who it was
> Anyway I you mentioned using money as integers.
> I set the money field to integer however there is no currency in the
object
> inspector (boolean)
> so I used currency type instead.
>
> So far so good with using currency type.
> You still didn't mention how to add up each row of money.
> Anyone know how?
>
> Ben Iti
>
>
> >From: "Ben none" <[EMAIL PROTECTED]>
> >Reply-To: [EMAIL PROTECTED]
> >To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
> >Subject: [DUG]: Another question
> >Date: Thu, 17 Jul 2003 21:45:24 +0000
> >
> >Hi there
> >
> >I want to add up the money field in each record in the clientdataset.
> >How do I go about doing that?
> >
> >I thought it might be like this.
> >
> >procedure TForm1.Calculate;
> >var
> > i : integer;
> > money, blank : float;
> >begin
> >blank := 0;
> >for i := 0 to ClientDataSet5.RecordCount do
> > money := Floattostr(ClientDataSet5.Field.Fieldname('Money).AsString);
> > blank := money + blank;
> >end;
> >
> >Gotta go to work.
> >
> >Ben Iti
> >
> >_________________________________________________________________
> >Check out the Xtra gaming servers at http://xtramsn.co.nz/gaming !
> >
>
>---------------------------------------------------------------------------
> > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> > Website: http://www.delphi.org.nz
> >To UnSub, send email to: [EMAIL PROTECTED] with body of
"unsubscribe
> >delphi"
> >Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
>
> _________________________________________________________________
> Check out the Xtra gaming servers at http://xtramsn.co.nz/gaming !
>
>
---------------------------------------------------------------------------
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the [EMAIL PROTECTED]
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/