Click to See Complete Forum and Search --> : Formula to Summarizie records


dummyagain
March 9th, 2007, 06:16 AM
Hi, I have a report which will obtain following set of data, for example:

NumberPacking CasePackingDesc Amount
2 Bottle 32kg
1 Bottle 10kg
2 Case 10kg
------------------------------------
TOTAL 3 Bottle 52kg
2 Case

I have problem generating the TOTAL of 3 bottle and 2 case. I would like to write a formula field to return the result, but I don't know how to loop though all the records in the record sets.

Here is the formula field I have done so far:

Local stringVar temp := "";
Local numberVar i;
for i:= 1 to DistinctCount({Table.CasePackingDesc}) step 1 do
(
temp := temp + CStr (Sum ({@NumberPacking})) + {Table.CasePackingDesc} + Chr(13);
);
temp

It basically return the same CasePackingDesc for 2 times.

Any idea on this will be greatly appreciated, thanks!

polli
March 19th, 2007, 10:34 AM
have you tried the
WhilePrintingRecords
Statement to loop through the Datasets.

You dont need the for loop in the formulafield.
Write the Result of your account in a global variable.