Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to make this code faster
Message
De
02/05/2013 15:15:56
 
 
À
02/05/2013 13:51:25
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 7
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01572484
Message ID:
01572543
Vues:
40
I believe IF /ELSE will be faster than CASE.

>see inline code changes.
>Try set relation and changing the seek to test for eof(alias_of_seek)
>
>>Little change in my code and it is taking little less time.
>>
>>How to do below code with REPLACE ?
>>
>>
>>Local lcmasterid, lnavgrec1, lnavgrec2, lnavgrec3, lnpackno, lntakano, lntotrec, lntrnno
>>USEFILE('cuttm')
>>USEFILE('cuttct')
>>USEFILE('packtc')
>>lntakano = 0
>>Select cuttm
>>Set Order To takano && if you set the oreder explicitly, leave out the index name in seek / less parameters often faster
>>Select packtm
>>Set Order To MASTERID
>>Select packtc
>>Set Order To takano
>>Select cuttct
>>Set Order To && set later if needed!
>>
>>Wait Window 'Working... Taka... Please Wait...' At Srows() / 2, Scols() / 2  Nowait
>>
>>Select cuttct
>>Scan For Not Empty(takano)    && Created a BINARY index on empty(takano)
>>   Do Case
>>      Case Seek(takano, "packtc")  && sure of your logic ? record will not be reset in otherwise if 2nd seek fails! ?AND?
>>         If Seek(packtc.MASTERID, 'packtm')
>>			Replace	;
>>					packed With	Iif(packtm.packno <> 0, 'Y', ' ') ;
>>					packno With	packtm.packno ;
>>					recuttno  With 0  
>>         Endif
>>      Case Seek(takano, "cuttm") or Seek(takano, "cuttm")
>>         Replace packed With Iif(cuttm.trnno <> 0, 'Y', ' '), packno With 0, recuttno With cuttm.trnno 
>>      Otherwise
>>         Replace packed With ' ', packno With 0, recuttno With 0
>>   Endcase
>>Endscan
>>Wait Clear
>>
>>
>>
>>Warm regards,
>>mk.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform