Subject: | Re: Code running Slow
| Date: | Sat, 20 Oct 2018 06:32:55 -0400
| From: | "Kevin Baker" <shcsbaker@gmail.com>
| Newsgroups: | pnews.paradox-programming
|
Günter,
I took it out and there was no performance increase, using your code I did
check and it does dataunlockRecord for each line on the tf. Not quite sure
why that's necessary, will have to talk with the owner of the company and
see if there was a reason behind this. I did fine some information about
using SetBatchOn() and I also added tc.edit and DelayScreenUpdates. Adding
this makes the form open in 4-5 secs, but not too sure what effects
SetBatchOn will have. This is the updated code:
Proc ReCalc()
var
tc,tc1 tcursor
tf uiobject
endvar
tc.attach(CHECKS)
tf.attach(CHECKS)
tf.action(dataunlockrecord)
tc.edit()
tc.SetBatchOn()
DelayScreenUpdates(Yes)
if tf.atFirst() and tf.CkIDNum.isBlank() then
return
endif
if tc.atFirst()then
movetorecord(tc)
cp=tf.Payment
cd=tf.Deposit
tc.balances=0+cd-cp
while not tc.atLast()
pb=tc.balances
tc.nextRecord()
cp=tc.payment
cd=tc.deposit
tc.balances=(pb)-(cp)+(cd)
endwhile
else
if not tc.atFirst() then
tc.priorRecord()
while not tc.atLast()
pb=tc.balances
tc.nextRecord()
cp=tc.payment
cd=tc.deposit
tc.balances=(pb)-(cp)+(cd)
endwhile
endif
endif
tc.endEdit()
tc.SetBatchOff()
tc.close()
DelayScreenUpdates(No)
endProc
"Günter" wrote in message news:5bcaf4a4$1@pnews.thedbcommunity.com...
code is clear, the only problem i see is
tf.action(dataunlockrecord)
is it possible,that thie line creates a loop?
the other possibility is to check:
ali = 0
while Condition
ali=ali+1
if ali>20000 then
ali.view()
quitloop
endif
endwhile
in my programs all whileloops are in this way a litte bit safer
Günter
Am 20.10.2018 um 09:39 schrieb Kevin Baker:
> Hi Everyone,
>
> I've got a Checkbook style form and when I open the form, I run a custom
> procedure to recalc the balances. When I have local share turn OFF, the
> form opens in 3-4 secs (the db has around 20,000 records), when I turn
> local share to ON, the form then takes 45-50 secs to open.
>
> Here's the code on the ReCalc. CHECKS is the name of the tableframe,
> which I set a GenFilter on before running the below code. The GenFilter
> uses the last bank opened. Any ideals of why changing the local share
> causes such a big change.
>
> Thanks,
> Kevin
>
> Proc ReCalc()
>
> var
> tc,tc1 tcursor
> tf uiobject
> endvar
>
> tc.attach(CHECKS)
> tf.attach(CHECKS)
> tf.action(dataunlockrecord)
>
> if tf.atFirst() and tf.CkIDNum.isBlank() then
> return
> endif
>
> if tc.atFirst()then
> movetorecord(tc)
> cp=tf.Payment
> cd=tf.Deposit
> tc.balances=0+cd-cp
>
> while not tc.atLast()
> pb=tc.balances
> tc.nextRecord()
> cp=tc.payment
> cd=tc.deposit
> tc.balances=(pb)-(cp)+(cd)
> endwhile
> else
> if not tc.atFirst() then
> tc.priorRecord()
> while not tc.atLast()
> pb=tc.balances
> tc.nextRecord()
> cp=tc.payment
> cd=tc.deposit
> tc.balances=(pb)-(cp)+(cd)
> endwhile
> endif
> endif
> endProc
|