>>>I have a report expression with a UDF in the group summary band which uses the sum feature to calculate total board feet for the group. I also have another expression in the group summary band using the sum feature to calculate total sales for the group. I want to use these two totals to calculate average sales/1000 bf. I have tried using report variables to store the totals but I always get an eror saying it can't find one of the fields required by the UDF when I do this. Is there any way to access these two calculated totals so I can use then in another expression?
>>
>>I don't remember 2.0 report capabilities, but could you create one more variable storing sales/bf and calculating average for group footer.
>
>Thanks for your quick reply. I am a new graduate with no previous experience with Foxpro. So far I have been able to do what I need but this one is still a problem!
>I can get the average of the individual sales that way but what I want is a weighted average by dividing the total sales by the total boardfeet. for example if there are three sales: 800 boardfeet for $132.00, 1372 bf for $240.00, and 352 bf for $120.00 I can get an average of $226.94. What I need is the total sales of $492.00 (which is printed in the group summary band)* 1000 / the total boardfeet of 2524 (also printed in the group summary band) for an average of $194.93/1000 bf. The report calculates the required totals but I don't know how to access these two figures to use them to calculate the "weighted" average. I have also tried writing a program called from the group summary band with it's own sql select based on a variable to select only the records that belong to the current group. I didn't get any errors that way but I didn't get the right results either! Maybe my logic isn't quite right for pulling the right records. I created a report variable based on the group criteria
>(reset it at the end of each group) and then selected the records from the original cursor table matching the report variable. Do I need to do a new select instead of pulling from the cursor created from the original select? I thought that might require alot of time and memory as this report takes quite awhile to run on our server as it is. I appreciate any other suggestions you might have as to whether this is possible or not.
I didn't have any problems making quick test in VFP3.0b. It works Ok. I used just two variables calculating sum for group getting the results you requested. Maybe, 2.0 has some limitations here (I really don't remember that stuff).
Edward Pikman
Independent Consultant