Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Avg function
Message
 
 
To
27/06/2005 09:58:19
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01026694
Message ID:
01026724
Views:
12
Chaim,

If you are averaging less than the max number of parameters to a function there's no need to bother with a cursor:
* only 15 shown for brevity...
function AvgValues( p01, p02, p03, p04, p05, p06, p07, p08, p09, p10, p11, p12, p13, p14, p15 )

local lnSum, i
lnSum = 0
for i = 1 to pcount()
   lnSum = lnSum + eval( "p" + padl( i, 2, "0" ) )
endfor

return lnSum / pcount()
>Help please
>How can I get variables/properties average?
>The function avg() give me the average only from table\cursors.
>I can't run:
avg(3,5)
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform