Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report group math problem 1

Status
Not open for further replies.

Soundsmith

Programmer
Feb 21, 2001
84
US
I'm running VFP 6.0 on a Win2000 platform. I have a report which gets Primary Language data from a table. The client needs totals and percentages at three levels, Unit, Division and Grand total.

I compute the Unit levels as values in the table, with an additional field for row totals. Then the rows are reported as detail items, with a second row on the report detail band directly below the values which shows the percentage relative to the row total, Ltotal.

The formula for column L7 (English language,) for example is
IIF(L7>0,IIF((INT((L7/Ltotal*100)+.5)=0),'<1%',(STR(INT((L7/Ltotal*100)+.5))+'%')),'')

This formula is repeated under each of 39 languages, and works perfectly for each row. The problem is with the groups. Group sub-totals and grand totals are computed using the same formula in the group band, with the Calculate field set for the appropriate group level.

Group totals display correctly, but I am unable to get the percentages to work, they always use the last row value rather than the group value no matter how I set the Calculate field selection.

I've tried, just to test, breaking this down to a far simpler IIF(L7>0,L7/Ltotal,0). The result is the same.

How can I get these to work? I could swear they worked perfectly under Windows 98, and the customer never had a problem, but since we've updated, this has changed.
David 'Dasher' Kempton
The Soundsmith
 
Hi
I suggest, you use a variable in the report to represent the L7 value. Fox Example, variable created as..
myL7
Initial Value = 0
Value to store = L7
Reset at = &quot;Your Group Level&quot;
and click SUM

At the Group level, use this variable myL7 in your formula and dont use any total or calculation.
This shall solve your problem :) ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
LET KNOW IF THIS HELPED. ENOUGH EXPERTS ARE HERE TO HELP YOU OUT! BEST OF LUCK :)
 
Thanks Ramani,

I have used this method in the past to get grand totals, but I didn't used to need it for group subs.

In the group band, I could ask for the L7 value and it's there, but when I try to use it in the calculation, it uses the row value, not the group-level one.

This will be OK (but with 39 of them, it takes a bit of retro-coding to make it work...) s-)
David 'Dasher' Kempton
The Soundsmith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top