sedek Posted May 13, 2011 Posted May 13, 2011 I have a report that calculates the number of units per hour by dept. The report is sorted by dept. I have a summary field for each dept that calculates total hours worked in the dept. QTY is the number of units that will be divided. It does not change (not a global field however) The calculation is simple: QTY divided by that summary field. Problem is: Calculation will always put the result of QTY/ total hours worked by all dept together and show the same number everywhere. The result only makes sense for report total.
sedek Posted May 14, 2011 Author Posted May 14, 2011 Have a look at the GetSummary function. GetSummary seemed to be the solution. I had already been through that. I lost a couple hours on it only to end up with ? values. I don't think I understand how to make it work. It's sad because I used to make reports like this many years ago with Foxpro (SQL) and never ran into this kind of bug. Is there another way to solve the problem ?
comment Posted May 14, 2011 Posted May 14, 2011 Why don't you post a file showing the problem? It's difficult to understand your setup, esp. this part: QTY is the number of units that will be divided. It does not change (not a global field however) If it's not in a global field, then where is it?
sedek Posted May 14, 2011 Author Posted May 14, 2011 Why don't you post a file showing the problem? It's difficult to understand your setup, esp. this part: If it's not in a global field, then where is it? The sum of hours is in HOURS,the main table of the report the sub-summary is by DEPARTMENT (a second table) The field QTY is from a third table (ORDERS) (See the attached screen capture on my first post) I did successfully use GetSummary on another report, but the fields requested were all in the same table. That was easy. Since I'm not English speaking, there are some technical informations that get me really confused. I'm not sure in this case what is my breakField in the formula!
comment Posted May 14, 2011 Posted May 14, 2011 See the attached screen capture on my first post I have seen it - but it doesn't tell me anything about your setup. the sub-summary is by DEPARTMENT (a second table) GetSummary() will not work with a breakfield from a related table. You must use a "local" field as the breakfield (and adjust the sub-summary part and the sort order accordingly). The field QTY is from a third table (ORDERS) This is meaningless when we don't know what is the relationship between HOURS and ORDERS.
sedek Posted May 14, 2011 Author Posted May 14, 2011 Case solved. I never needed to use GetSummary in the first place. All I had to do was add the option on the summary field '' restart when sorted by'' Then everything fell in place. To think that I had the solution all that time just in front of my nose !! Thanks to everyone.
comment Posted May 14, 2011 Posted May 14, 2011 No, you don't have to use GetSummary() - but it is more flexible. For example, in your case it would eliminate the need to add the extra field, and the calculation would also work in a leading sub-summary.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now