Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
It is not possible to sum rounded subtotals!!
Message
From
27/12/1998 05:33:41
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
26/12/1998 15:16:31
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00169097
Message ID:
00170541
Views:
39
>>>How to produce the line "Total 9" in report?
>>
>>You'll need several report variables. One would have to keep the group expression, and be initialized to some impossible value.
>
>What is the value to store of this variable? Must it be
>last (third) in the order in the report variable list?

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)

>Maybe to add simply a field
>
>iif(rvGroupHasChanged, RoundedPersonsSalary, 0)
>
>to the summary band? This eliminates the need for a third variable.

I thought we may get a different total if we did the rounding at wrong time. In your example, three people get 3*1.4 rounding up to 3, but 9*1.4 may give 9 or 12, depending on when we do the rounding. When I do this, I'm not quite sure of what goes on behind the scenes, so each time I have to do some experimenting to see what gives. Just like someone said these days, "I didn't understand it until I saw it work, and then it just seemed natural".

I think the credit for this trick goes to Paul Vlad or Fast Eddie - can't remember too well, it was at least half a year ago.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform