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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FoxPro Reports, Grand Totals, and Averages Using Variables

Status
Not open for further replies.

drosenkranz

Programmer
Sep 13, 2000
360
US
I'm writing a report using the group section to display totals. The detail section is closed and has no info in it by design. I'm using memory variables to count quantities for each of 20 possible reason codes that could occur during each group. I print these 20 reason codes and their counts out in the group section .

I used IIF's to get the individual counts for the 20 codes- and these work fine. I added some of the twenty codes into 4 sub-total values and each of these sub-tots are okay. I then added all 20 into a grand-total value and that was ok. Then comes the trouble.

Now I need to produce percentages for each of the four subtots with respect to the grand tot. There is not enough space to cut and paste all of the fields to represent the (subtot / grandtot * 100) formula in the box.

I tried using IIF's for the subtots but the counts would miss the very last record and they'd be one off the correct count. I think the subtots should be evaluated as expressions to memory variables but I can't figure out how to get them to do it.

How do I store these "group" totals to memory variables so I can do the math for the percentages?
 
Hi,
The simple way is calculating everything and put these data into one table. Your report just prints it out

Hope it helps
Jimmy

mailto:nhan_tiags@yahoo.com
 
If you have a variable for each subtotal, and a variable for the grand total.
To calculate the subtotals use report variables

nSubtotal1:
IIF(code="what ever",nSubtotal1 + AdditionalAmount,nSubtotal)
etc...

In your summary section insert a blank field for each percentage

nSubtotal1/nGrandtotal*100

Good Luck!
-Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top