Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to make this code faster
Message
From
02/05/2013 13:04:03
 
 
To
02/05/2013 12:02:01
Mk Sharma
Shrishti Solutions
Mumbai, India
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01572484
Message ID:
01572506
Views:
41
I don't have enough time right now to debug this or even complete its logic, but something like this may be faster:
* Create a second usage of cuttm
select cuttm
use (fullpath(dbf())) again in 0 alias cuttm2
set order to takano

* Set relationships
Select cuttct
set relation to takano into packtc

select packtc
set relation to masterid into packtm

select cuttct
set relation to takano  into cuttm
set relation to takano1 into cuttm2 additive

* Perform a single replace
select cuttct
REPLACE ALL FOR not empty(takano) ;
        packed   With iif(not eof('packtc'), iif(eof('packtm'), 'Y',           space(1)), falseLogic code), ;
        packno   With iif(not eof('packtc'), iif(eof('packtm'), packtm.packno, 0),        falseLogic code), ;
        recuttno With && I think there's an error in your logic here
Best regards,
Rick C. Hodgin


>How to make this code faster with Sql - Update or any other way ?
>
>
>*- updtakastk.prg
>****
>Local lcmasterid, lnavgrec1, lnavgrec2, lnavgrec3, lnpackno, lntakano, lntotrec, lntrnno
>USEFILE('cuttm')
>USEFILE('cuttct')
>USEFILE('packtc')
>lntakano = 0
>Select cuttm
>Set Order To takano
>Select cuttct
>Set Order To takano
>Select packtm
>Set Order To MASTERID
>Select packtc
>Set Order To takano
>Select cuttct
>
>Wait Window 'Working... Please Wait...' At Srows() / 2, Scols() / 2  Nowait
>
>Select cuttct
>Scan
>
>   lntakano = takano
>   If Not Empty(m.lntakano)
>      **    Below code taking Maximum time in Coverage result
>      Replace packed With ' ', packno With 0, recuttno With 0 In cuttct
>      If Seek(m.lntakano, 'packtc', 'takano')
>         lcmasterid	= packtc.MASTERID
>         lnpackno	= Iif(Seek(m.lcmasterid, 'packtm', 'masterid'), packtm.packno, 0)
>         **    Below code taking Maximum time in Coverage result
>         Replace packed With Iif(m.lnpackno <> 0, 'Y', ' '), packno With m.lnpackno In cuttct
>      Else
>         lntrnno =	Iif(Seek(m.lntakano, 'cuttm', 'takano'), cuttm.trnno, 0)
>         Replace packed With Iif(m.lntrnno <> 0, 'Y', ' '), recuttno With m.lntrnno In cuttct
>
>         lntrnno =	Iif(Seek(m.lntakano, 'cuttm', 'takano1'), cuttm.trnno, 0)
>         Replace packed With Iif(m.lntrnno <> 0, 'Y', ' '), recuttno With m.lntrnno In cuttct
>      Endif
>   Endif
>Endscan
>Wait Clear
>
>
>
>Warm regards,
>mk.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform