Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Service in Groups
Message
 
 
À
18/09/2008 13:37:03
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01348676
Message ID:
01348937
Vues:
13
>It does not matter, I shall wait for solution

Hi Tariq,

I was thinking a bit about your problem. Here is how I can approach it.
Select ceiling(year(EndDate) - year(StartDate)/5) as Period, 
count(*) as NumEmployees from curYears group by 1 order by 1 
into curToProcess readwrite
index on Period tag Period
go bottom in curToProcess
local lnMaxPeriod as Integer, lcCommand as String

lnMaxPeriod = curToProcess.Period && Maximum number of periods

** Now do we want to create field for every periods, even if we don't have them? Let's assume yes.

lcCommand = "create cursor curFinal  ("

for lnI =1 to m.lnMaxPeriod + 1
      lcCommand = m.lcCommand + "var" + transform(m.lnI) + " I " + (iif(m.lnI <=m.lnMaxPeriod, ", ", ")")
next

execsript (m.lcCommand) && or &lcCommand - create the curFinal cursor

append blank in curFinal
scatter memvar

for lnI =0 to m.lnMaxPeriod 
   if seek(m.lnI, 'curToProcess')
       store  curToProcess.NumEmployees to ("m.var" + transform(m.lnI +1))
   endif
next

gather memvar  
** Now we have our curFinal with one line of all number of employees per period of service.
This is from the top of my head - not tested.
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform