Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Blank fields change average values
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00435828
Message ID:
00435855
Views:
15
>Hi all
>
>I've noticed that when generating reports, VFP takes a blank field as a zero - which effects the average of the values at the end of a report I'm generating. Does anyone know a simple way to get around this - I've been exporting the tables to Excel, which simply ignores the blank fields (for the purposes of averaging)...but I'm quickly getting sick of doig it this way.
>
>Thanks in advance...
>
>
>Chris Kable
>FuelTrac

Don't use Foxpro's native average calculation. Instead, use report variables to calculate your own average. Have one variable, nSum, that has an expression of IIF( <> 0, , 0) and has "SUM" marked as the calculation. Then create another variable, nCount, that has an expresion of IIF( <> 0, 1, 0) and mark "SUM" as the calculation. When you are ready to print the average, create an expression that is "nSum / nCount".

It's more work on your part, but it will work.

Cathy
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform