Detail Percentage of Group Total multiple pages
Hi,
Consider the following raw data:
Item Type Item Uses
================================
Item 1 Item 1A 2
Item 1 Item 1B 1
Item 1 Item 1C 1
Item 2 Item 2A 6
Item 2 Item 2B 2
I am looking be able to look at usage, to calculate the percentage of
use of each items of a type (a group), and the variance from the average
(to look for over- or under-utilisation of an individual item), giving a
result set such as this:
Item Type
Item Uses Percentage Variance
========================================================
Item 1
Item 1A 2 50 % + 16.67 %
Item 1B 1 25 % - 8.33 %
Item 1C 1 25 % - 8.33 %
Total: 4 Avg: 33.33 %
Item 2
Item 2A 6 75 % + 25 %
Item 2B 2 25 % - 25 %
Total: 8 Avg: 50 %
I found some code linked in a previous support entry on this newsgroup
using the "GetLookAheadTotal" function:
http://www.digital-metaphors.com/tips/CalcUsingLookAheadValuesRAP.zip
With minor adaption, this works as expected - UNTIL the number of items
within a group causes the group to flow across multiple pages.
For the first detail after the page break, the Percentage and Variance
are both 0. The second (and subsequent) detail on the page are
calculated correctly.
On my second page, I would get:
Item Type
Item Uses Percentage Variance
========================================================
Item 1
Item 1X 2 0 % + 0 %
Item 1Y 1 25 % - 8.33 %
Item 1Z 1 25 % - 8.33 %
I have spent most of the day so far getting to this point, believing it
to be working with small groups, and then I find that a large group
causes this issue, as I hope you can appreciate, is a touch frustrating!
Any assistance will be greatly appreciated, if you would like a working
sample of data and the .rtm file to investigate, then don't hesitate to
ask.
For reference, I am using RB 15.05 build 275
Regards,
Garry Mitchell
This discussion has been closed.
Comments
Be sure the variable you are using to make these calculations has a
numeric data type, not string.
Please send a simple example of this in .zip format to
support@digital-metaphors.com and I'll take a look at it for you.
Also, for future reference, you can use our RBWiki site to find
accompanying articles with many of the examples we provide such as the
one you are referring to.
http://www.digital-metaphors.com/rbWiki/Delphi_Code/Calculations/How_To...Use_a_Look_Ahead_Value_in_a_Calculation
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com