Grand Totals

Hello

How to write an aggregate function with the aggregate function.

Sum( a* sum(n)) .

I need total of a* Sum(n).

Please help.

Thanks

Barathy

do you want to find a total of a field and multiply with other constant ?

you mentioned sum(a*sum(n))

a & n are table fields ?

or a is constant?

a & n are table fields.

a - unitcost

n- remaining qty

inventory = Unitcost * Sum(remainingqty)

I need the total inventory,

lets declare Record variable(RV),and a decimal Variable (DV)

Step1:To get sum(Remaining qty)
RV.RESET;
if RV.FINDFIRST then begin
repeat
DV:= DV + RV.
until rv.next = 0;
end;
DV have the total remaining qty

now multiply with unit cost so

declare Decimal variabl DV1

DV1 := unitcost * DV

Now find the total of DV1(Inventory):

declare record variable RV1

RV1.RESET;
if RV1.FINDFIRST then begin
repeat
DV1:= DV1 + RV1.
until rv1.next = 0;
end;

Waiting for your reply

Jerome Marshal.J