Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Manipulating non-detail variables in a report
Message
From
29/07/1999 09:54:55
 
 
To
24/07/1999 13:30:57
David Abraham
David Abraham & Associates, Inc.
New York City, New York, United States
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00242254
Message ID:
00247650
Views:
23
David,

problably this can be done also without external fxp file (this is faster, but more complicated). Dragan wrote some times ago:

Order of variables:

1. one to keep the group expression, initialize to non-existing value (so it is different from the first group), assign group expression

2. rvGroupHasChanged, initialize to .f., assign FirstVariable=GroupExpression

3. third one goes to keep the totals of the rounded values per person (or just for grand total)

The basic layout is like this:

first variable rvGroupExpr
inital value = non-existent value
assign value = group expression
reset at group, calculate nothing

second variable rvIsGroup
initial value .f.
assign value = rvGroupExpression # groupExpression
reset at end of report, calculate nothing

third variable, rvTotal
initial value=0
assign value = iif(rvIsGroup, < your hours total per person comes here >, 0)
calculate total, reset at outer group or end of report

You may try different ordering of the first two variables, and the initial value for the rvIsGroup - it should be .t. only when group expression changes, and the third should add only when it becomes .t., i.e. only once in a group. I think that's all - unfortunately, I can't be exactly sure if this reconstruct is quite correct.

>
>Thank you so much for your splendid idea. I was beginning to go in that direction (what was left after all?) but you saved me MANY hours, so thank you very much.
>
>My routine is called AM_total, in recognition of its source.
>
>David
>
>++++++++++++++++++++++++++++++++
>>>I created a Sales Commission Report using VFP's Report Designer.
>>>
>>>It has 5 breaks (bands), major to minor: salesman, date, order#, shipment#, detail line.
>>>
>>>I feed the report a single cursor (not a requirement, just seems to be the way to do it) which has loads of data at the detail level and some data (including numeric values) at the group (shipment#, order#) level.
>>>
>>>Some of the expressions I print in report footers are not sums of detail amounts but rather amounts that belong to break level data. F'r instance, the cursor has a column that is a shipment amount and I display that for the first time in the shipment# footer band.
>>>
>>>It is easy enough to display this at the Shipment# level, but when I go to SUM it for the next level, the Order# level, it is all screwed up, as it seems to add it up once for every detail line, not once per shipment, even though it is a figure that does not belong to the detail level.
>>>
>>>If I have been clear, what do I do to correctly calculate and display a SUM of non-detail numbers?
>>
>>1. Add a variable named r_Sum to report/variables:
>> Initital value 0
>> Value to store 0
>> Calculate Sum
>> Reset at End of report
>>
>>2. In group footer, add a field and use
>> total( , 'r_sum' )
>>
>>
>>func TOTAL
>>PARAMETER subTot, prmVARIABLE
>>store eval(m.prmVARIABLE) + m.subTot to (m.prmVARIABLE)
>>RETURN ''
Andrus
Previous
Reply
Map
View

Click here to load this message in the networking platform