Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is there a better (faster) way
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Is there a better (faster) way
Divers
Thread ID:
00362228
Message ID:
00362228
Vues:
47
I've got a form that is used to generate a YTD report. It starts by letting the user select the starting month (combobox) and starting year(Combobox). Then it creates determines the starting date/and ending date for a 12 month period. From that I generate a SQL statement and load a table, I run the table through the cross-tab routine. This part is all really snappy and fast. But since the cross-tab only creates fields for months with data, I run the code listed below to populate a report table. I'm using a do case routine, and this part is really slow. The cross-tab routine with the sample data I'm using only has 29 records, yet it takes about 2 minutes on a PIII 600 256Megs of ram and win2000 pro to process. It works, it's just slow. Any help on how to speed this up would be greatly appreciated.

***- Code Begins
select ytdtable_a
=afields(laFields)
scan
* Set the Description
m.description=ytdtable_a.ROWDESC
* Set Initial Values to 0
store 0 to m.mon1,m.mon2,m.mon3,m.mon4,m.mon5,m.mon6,m.mon7
store 0 to m.mon8,m.mon9,m.mon10,m.mon11,m.mon12,m.rowtotals
* Loop Through the fields in the field array and store their value
lnRowTotal=0
for x=2 to alen(laFields,1)
do case
case allt(laFields[x,1])=[C_01] && January
m.mon1=ytdtable_a.c_01
lnRowTotal=lnRowTotal+ytdtable_a.c_01
case allt(laFields[x,1])=[C_02]
m.mon2=ytdtable_a.c_02
lnRowTotal=lnRowTotal+ytdtable_a.c_02
case allt(laFields[x,1])=[C_03]
m.mon3=ytdtable_a.c_03
lnRowTotal=lnRowTotal+ytdtable_a.c_03
case allt(laFields[x,1])=[C_04]
m.mon4=ytdtable_a.c_04
lnRowTotal=lnRowTotal+ytdtable_a.c_04
case allt(laFields[x,1])=[C_05]
m.mon5=ytdtable_a.c_05
lnRowTotal=lnRowTotal+ytdtable_a.c_05
case allt(laFields[x,1])=[C_06]
m.mon6=ytdtable_a.c_06
lnRowTotal=lnRowTotal+ytdtable_a.c_06
case allt(laFields[x,1])=[C_07]
m.mon7=ytdtable_a.c_07
lnRowTotal=lnRowTotal+ytdtable_a.c_07
case allt(laFields[x,1])=[C_08]
m.mon8=ytdtable_a.c_08
lnRowTotal=lnRowTotal+ytdtable_a.c_08
case allt(laFields[x,1])=[C_09]
m.mon9=ytdtable_a.c_09
lnRowTotal=lnRowTotal+ytdtable_a.c_09
case allt(laFields[x,1])=[C_10]
m.mon10=ytdtable_a.c_10
lnRowTotal=lnRowTotal+ytdtable_a.c_10
case allt(laFields[x,1])=[C_11]
m.mon11=ytdtable_a.c_11
lnRowTotal=lnRowTotal+ytdtable_a.c_11
case allt(laFields[x,1])=[C_12]
m.mon12=ytdtable_a.c_12
lnRowTotal=lnRowTotal+ytdtable_a.c_12
endcase
endfor
* Set the report ID, This is how we will requery on
m.rowtotals=lnRowTotal
m.reportid=lnReportID
m.recordid=val(gnextid('MONTHST'))
m.reportgroup=[DISCIPLINE]
insert into monthst from memvar
endscan
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform