Subject: | Re: Code running Slow
| Date: | Sat, 20 Oct 2018 08:48:05 -0400
| From: | "Steven Green" <greens@diamondsg.com>
| Newsgroups: | pnews.paradox-programming
|
locks and batches and postrecords are functions of having shared data.. if
you're absolutely 100% sure there's nobody else there, even if the data is
on the server, you can handle things differently.. defense, defense,
defense.. I use a global semaphore flag, in every app, that simply tracks
"am I alone?"
you still need to check postrecord to see if something slipped thru the
cracks in your own process, but that's a different issue
--
Steven Green
Myrtle Beach, South Carolina, USA
http://www.OasisTradingPost.com
Collectibles and Memorabilia
Vintage Lego Sets and Parts
- and Paradox support, too
"Kevin Baker" wrote in message news:5bcb0458$1@pnews.thedbcommunity.com...
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
|