Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Count record
Message
 
To
02/09/2004 17:17:53
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00938858
Message ID:
00938991
Views:
23
Mohammed, the lines:
  myArray[i, 1]                && To use Area Code i
  myArray[i, 2]                && Team i
  myArray[i, 3]                && Count i
were only intended to show how to access AreaCode, Team and Count for each occurrence, they should be part of an expression to be valid, like:
* Calculate the total
lnTotal = 0
for i = 1 to alen(myArray, 1)
  lnTotal = lnTotal + myArray[i, 3]
next i

* Print percentajes
if lnTotal > 0
   ? 'Area Code', 'Team', 'Count', 'Percentaje'
   for i = 1 to alen(myArray, 1)
     ? myArray[i, 1], myArray[i, 2], myArray[i, 3], myArray[i, 3] / lnTotal * 100
   next i
endif
What i am posting is not exaclty what you should use, it is just a pointer of how can you do it

>hi,
>i'll try as under
>
>i get error message (myArray is not function,procedure or program)
>
>
>SET TALK OFF
>SET ECHO OFF
>SET SAFETY OFF
>PUBLIC s
>USE table1
>local myArray(1)
>select areacode, team, count(*) from table1 group by areacode, team into array myArray
>
>for i = 1 to alen(myArray, 1)  && Number of rows in the array
>  myArray[i, 1]                && To use Area Code i
>  myArray[i, 2]                && Team i
>  myArray[i, 3]                && Count i
>next i
>
>
>thanks.
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform