Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Compute many operations
Message
 
 
À
05/09/2004 01:26:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00939290
Message ID:
00939634
Vues:
20
Ok, now I start to understand you. See, if this code will help you get going:
select areacode, team, count(*) as TeamCount from table1 ;
group by areacode, team into cursor curTeamCount
select areacode, count(*) as AreaCount from table1 ;
group by areacode into cursor curAreaCount

select curTeamCount.areacode, team, TeamCount, ;
         AreaCount, TeamCount/AreaCount*100 as Percentage ;
         from curTeamCount inner join curAreaCount on ;
                 curTeamCount.areaCode = curAreaCount.areaCode into cursor curFinal
* Close cursors, which are no longer needed
use in curAreaCount
use in curTeamCount
? 'areacode', 'Team', 'Count', 'Percentaje'
select curFinal && our final result with all information
scan
     ? AreaCode, Team, TeamCount, Percentage
endscan
use in curFinal
=============
Hooray! I checked "Skip" thread and I now see, that you meant "operations" in the title of your thread. I didn't get it for few days! :)

>hi,
>
>ok, can you help me,with this code under
>to get result as Percentaje for every areacode,
>this code get Percentaje for all areacode.
>
>>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
>>
>>lnTotal = 0
>>for i = 1 to alen(myArray, 1)
>>  lnTotal = lnTotal + myArray[i, 3]
>>next i
>>
>>* Print percentajes
>>if lnTotal > 0
>>   ? 'areacode', '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
>>
>
>
>thanks.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform