Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sum of field based on date
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01154432
Message ID:
01154639
Vues:
12
>I have a table used in report with two fields SOMEDATE and SOMENUMBER.
>
>I have made group by SOMEDATE in report.
>
>I want in group footer to show total SUM of SOMENUMBER for dates before date that is current in group.
>
>How to do that? (preferably it would be variable)

First, let me make sure I completely understand what you want. If you have the following data ... you want to see the following subtotals ...
1/1/06      10
            20
            --
This Total: 30   Prior Total: 0

1/2/06       5
            10
            15
            --
This Total: 30   Prior Total: 30

1/3/06      15
            20
             5
            --
This Total: 40   Prior Total: 60
Okay .. so assuming I understand your problem and you are looking for the "Prior Total" I showed above, here's how to do it.

1. Create a report variable called rnGrandTotal, set the expression to the SOMENUMBER field, set the Calculate option to SUM, and set the RESET point to End of Report.

2. Create another report variable called rnPriorTotal, set the expression to 0, set the calculate option to SUM, and set the RESET point to End of Report. (By itself, this would yield zero at the end of the report .. but I'm not done yet so don't get worried yet)

3. In the On Exit Expression of the Group Footer band, put the following expression:
_VFP.SetVar('rnPriorTotal', rnGrandTotal)
4. Use rnPriorTotal in the Group Footer band to show the prior total.
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