Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
It is not possible to sum rounded subtotals!!
Message
De
21/12/1998 15:26:53
 
 
À
20/12/1998 18:59:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
00169097
Message ID:
00169420
Vues:
40
>>>Try this SQL to process the detail records:
>>>
>>>Select Name,Round(Sum(Sal),0) As Sal ;
>>> From Salary ;
>>> Group by name
>>
>>John, thank you for reply.
>>
>>My problem is that I have a ready finished program and
>>I need to send new report to program users.
>>
>>I can only change the report. This is FoxPro for Windows report,
>>so code cannot be attached. It is possible to call some external
>>fxp from report, but this cannot change report control table.
>>
>>A big database is opened before report and filter are set to it.
>>I am capable to change a report only or to call external fxps inside
>>report.
>
>Inaddition to what Dragan said...
>You could put a function call in your title band so it only gets called once. This function would summarise using SQL the amounts and put the results into a cursor. You then SET a RELATION from the report file to your new summary file. And just for safety, reselect the original table.
>You can then reference the summary fields automatically for the rest of the report.
>In the summary band of the report (which i think is called last) you can clear the relation and delete the cursor by calling another function.

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
Andrus
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform