Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Totals On Report For Fields That Meet Specific Conditions 1

Status
Not open for further replies.

drosenkranz

Programmer
Sep 13, 2000
360
US
New to VFP. I need group totals and then grand totals at the end of my reports that are based upon the "content of a field" occuring in each record in the group, not an actual count of "all" the records.

Example: I have a date_completed field. I need a count of how many records contained a date (#-completed) and a count of how many did not contain a date (#-pending) for the Group. I want to reset these counters after each group on my report.

I also need to keep a second set of counters for a Grand Total of all Pending and Completed cases. I tried using something like:

if empty(date_complete) = .T. then gn_pending = gn_pending + 1

in the report varaible but kept getting errors- couldn't seem to find "where" I can put a condition for "when" to count (increment).

Can you give me any info/tips on how to increment counters (varaibles?) based upon a field's condition and how/when to reset them for the next group from within a FoxPro report?

Thanks.
 
Probably the simplest way is to place variables in your reports. (reports menu, variables) Variables can be assigned intitial values, reset conditions and canned functions(SUM, AVG, COUNT etc).

To use your example, say you had a variable gn_pending. It's "Value to store would be"

=IIF(EMPTY(date_complete),gn_pending + 1, gn_pending)

Or something like that. If the circustance is really complex you can write your own function...

=IIF(myFunction(parameters),gn_pending + 1, gn_pending)

Keep in mind if you write your own function, the report has to be able to find it. Make certain the program with your function is in included in your SET PROCEDURE statement.

Enjoy!
-Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top