Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Carry forward a group total
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
01342833
Message ID:
01343336
Vues:
22
>Is there a way to carry a group total (calculated in the group footer) forward into the footer for the next group so that it can be used in a calculation to provide the % change between the 2 groups?
>
>Suppose the report is grouped on year, with columns for each month. In the footer for 2008 we want the calculate the % change for jan08 over jan07.
>
>IE result = (jan08grouptotal - jan07grouptotal) / jan07grouptotal
>
>Thanks


Let's say you need 12 totals .... one for each month ...

Create 24 report variables; rnJanPrev, rnFebPrev, ... rnDecPrev, rnJanCurr, rnFebCurr, ... rnDecCurr. For the "Prev" variables, set the initial value to 0, set the expression to 0, set the calculate option to SUM and have them reset at end of report. For the "Curr" variables, set the initial value to 0, the expression to whatever field you need, and reset at the data group.

In the OnExit expression of the data group footer enter this:
_VFP.SetVar('rnJanPrev', rnJanCurr) AND _VFP.SetVar('rnFebPrev', rnFebCurr) AND ... _VFP.SetVar('rnDecPrev', rnDecCurr)
In the data group footer, print (rnJanCurr - rnJanPrev) / rnJanPrev ... and so on.
Cathy Pountney, Microsoft Visual FoxPro MVP
Memorial Business Systems, Inc. (www.mbs-intl.com)

My Website: (www.frontier2000.com)
My Blog: (www.cathypountney.blogspot.com)
My Book: The Visual FoxPro Report Writer - Pushing it to the Limit and Beyond
Free MSDN Article: What's New in the VFP 9.0 Report Writer
Free MSDN Article: The VFP 9.0 Report Writer In Action
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform