Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

AppendDB & Progress Bar - Source server stays open

104 views
Skip to first unread message

Philippe Bayard (Belgium)

unread,
Apr 30, 2013, 5:33:01 AM4/30/13
to
Hi everyone,

i'm having some trouble to display a progress bar during an appendDB.
In my windows i have this code :

self:oDCMaxRecord:value := nbRecord1 //Number of records in source file
self:oDCProgressBar1:value := 1
self:Max := nbRecord1
if self:Max >100000
self:istep := self:Max / 1000 // Refresh every nStep records
self:oDCProgressBar1:Range := Range{1,1000}
elseif self:Max / 100 > 0
self:istep := self:Max / 100
self:oDCProgressBar1:Range := Range{1,100}
else
self:istep := 1
self:oDCProgressBar1:Range := Range{1,self:Max}
endif

ftdbf := Path + FileName
cbEval :={||FUpdateProg(oself)} // Updating code
if ! oserv:appenddb(ftdbf,,,cbEval,, "DBFCDX" ,)
DebugLog("Unable to append")
ENDIF

With the function used in my code block:

Function FUpdateProg(oself)
if oself:nrecords % oself:istep == 0
oself:oDCProgressBar1:Advance(1)
if oself:nrecords < oself:Max
oself:odcNbRecord:value := AsString(oself:nrecords)
else
oself:odcNbRecord:value := AsString(oself:Max)
return false
endif
oself:odcpourcentage:value := AsString(Round((oself:nrecords/oself:Max)*100,0))+"%"
elseif oself:nrecords >= oself:Max
return false
endif

oself:nrecords := oself:nrecords +1
ApplicationExec(EXECWHILEEVENT) // rgtr 090508

RETURN true

The problem is that when my appendDB is done with true as return value, the source server ftdbf remains opens and i cannot delete it and i cant close it.

Am it doing something wrong?
I even try to just do

Function FUpdateProg(oself)
ApplicationExec(EXECWHILEEVENT) // rgtr 090508
RETURN true

But it does the same.

Does someone have any idea?



Philippe Bayard (Belgium)

unread,
Apr 30, 2013, 5:52:29 AM4/30/13
to
For information,when i just do

Function FUpdateProg(oself)
RETURN true

The source file is closed normally.
Seems like the ApplicationExec isn't a good idea...

Philippe Bayard (Belgium)

unread,
Apr 30, 2013, 6:45:01 AM4/30/13
to
Well it's that applicationExec who made it happens. If i remove it , it works right but i cant get the hand on the screen during the copy...

I don't understand...

Heiko J. Pongratz

unread,
Apr 30, 2013, 7:58:44 AM4/30/13
to
Phillipe,

I can�t really explain why the ApplicationExec locks your file. But usually
the parameter that you are using for the refreshing of the display is for
the while-condition codeblock. SO what you do is a bit tricky and maybe not
allowed :-)

But a possible solution for your problem would be to write an own appenddb
method. This wouldn�t be too difficult, because you don�t need to implement
all parameters from the original method and you only use a few...

Greetings Heiko

"Philippe Bayard (Belgium)" <philb...@gmail.com> schrieb im Newsbeitrag
news:6bbdf7e8-d66c-4fa4...@googlegroups.com...

Massimo Bighelli

unread,
Apr 30, 2013, 1:51:55 PM4/30/13
to
this I don't understand...
ApplicationExec is INSIDE FUpdateProg()
if this is OK, it's not ApplicationExec the problem...

maybe the codeblock?
try do not pass the server object via codeblock, instead pass the string
name, create/open/close it in your function

*Massimo Bighelli* ARCA Sistemi S.r.l.

Philippe Bayard (Belgium)

unread,
May 14, 2013, 8:08:36 AM5/14/13
to
Thanks for the answers

I think i'll rewrite de AppendDB in my way as suggested.

Phil.
0 new messages