Question about percents
Hi! everybody
I hope that anyone can help me, I need build a report like the next
WAREHOUSE 1
------------------------------------
| ORANGES | 4 | 20% |
------------------------------------
| LEMONS | 6 | 30% |
------------------------------------
| TOMATOES | 10 | 50% |
------------------------------------
| TOTAL | 20 | 100% |
------------------------------------
The problem here is how can I calculate de percent over the amoung, any
sugestion?.
thanks in advance.
I hope that anyone can help me, I need build a report like the next
WAREHOUSE 1
------------------------------------
| ORANGES | 4 | 20% |
------------------------------------
| LEMONS | 6 | 30% |
------------------------------------
| TOMATOES | 10 | 50% |
------------------------------------
| TOTAL | 20 | 100% |
------------------------------------
The problem here is how can I calculate de percent over the amoung, any
sugestion?.
thanks in advance.
This discussion has been closed.
Comments
the first pass, so you could access it in the second pass.
procedure Variable3OnCalc(var Value: variant);
var
ldTotal: Double;
begin
if Report.SecondPass then
begin
ldTotal := StrToFloat(TotalSales[Group1.BreakNo]);
if (ldTotal > 0) then
Value := (100/ldTotal)*DBText2.FieldValue
else
Value := 0;
end;
end;
procedure GroupFooterBeforePrint
begin
if Report.FirstPass then
TotalSales.Add(FloatToStr(DBCalc1.Value));
end;
HTH
-Jack
Another approach is to use RB's LookAhead feature to accomplsh this. Below
is an example that you can download
http://www.digital-metaphors.com/tips/UseLookAheadValueInCalc.zip
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com