Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
It is not possible to sum rounded subtotals!!
Message
From
22/12/1998 15:45:37
 
 
To
21/12/1998 16:05:13
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00169097
Message ID:
00169819
Views:
31
>>David,
>>
>>I am capable to display each group subtotal properly, so
>>the problem is to sum rounded subtotals.
>>
>>This can be solved by the following code in title or summary
>>band through fxp file:
>>
>>select person, round(sum(salary),0) as salary ;
>>from PAYROLL ;
>>into cursor subtotal ;
>>group by 1
>>
>>select sum(salary) ;
>> from SUBTOTAL ;
>> into array SUMMARY
>>
>>and putting summary[1] in the summary band.
>>
>>Unfortunately, my report command has while and for clauses also
>>and I must consider them too for summing!
>>
>>I have tried the following FOUR attempts but without success:
>>
>>1. Is it possible to determine the for and while clauses used in
>>the REPORT command in the fxp file called inside report?
>>I don't know a way to do it, your approach cannot be used.
>>
>>2. I'm thinking that there must be some pure mathematical way to
>>display the sum of rounded subtotals. Mayme some mathematican can
>>help me? George replies about ceiling but this seems
>>not to work. I must be possible to use avg(), sum() etc. aggregate
>>functions to do this?!
>>
>>3. The other solution may be also sum summary expression only
>>once in group footer, when group subtotal is already calculated
>>but not yet moved to other record.
>>
>>I want to put a field
>>
>>Expression iif( , round( personsalary,0) )
>>Calculate sum
>>
>>into summary band.
>>
>>However, I don't know what to wrote for
>>expression? MS KB documents trick for summing groups
>>
>>http://support.microsoft.com/support/kb/articles/q94/3/43.asp
>>Obtaining Number of Data Groups in .FRX Without Using UDF
>>
>>but is there a way to do it in last record of subtotal footer?
>>
>>4. Using some Genrepox command or its extension
>
>
>OK, I didn't know about FOR and WHILE restrictions. That means the appraoch needs to be using the report variables. You can create variables under Report|Variables menu. These can be automatically reset at any group end or end of report. You can use any expression to define the thing you are summing. I'm sure that your answer lies here.

David, i have the following table, for example:

Person Salary
------------------
Edward 1.4
Edward 1.4
Michael 1.4
Michael 1.4
Paul 1.4
Paul 1.4

I want do show subtotals rounded for each person and
display the sum those rounded subtotals in summary band.
Report for the data aboe must produce the following result:

Person Salary
-----------------
Edward 3
Michael 3
Paul 3
------------
Total 9

Can you give me instructions how to to this using report variables?
Andrus
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform