In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

TDbfDataSet:AddTag() error

Xailer English public forum
Responder
Gejza Horvath
Mensajes: 281
Registrado: Mar Ago 15, 2006 1:50 pm

TDbfDataSet:AddTag() error

Mensaje por Gejza Horvath »

Hi guys,
I have reported you a problem with progressbar in AddTag method of the TdbfDataSet class 3
weeks ago. Your response was:
"This seems to work correctly"
Yes, it seems to work ok, but in some cases the progressbar is not filled to 100%, after
the method is finished. Try please this method with attached file, which has 240 records.
Looking to the source I found a code, which is wrong in AddTag() method:
IF oPgBar != Nil
nCount := ::RecCount()
WITH OBJECT oPgBar
:nMin := 0
:nValue := 0
:nStep := 1
IF nCount > 100
nStep := Round( ( nCount / 100) + 0.5, 0 )
:nMax := 100
ELSE
nStep := 1
:nMax := nCount
ENDIF
END WITH
bEval := {|| oPgBar:nValue += 1, .T. } //!!!! Here is the problem !!!!
ENDIF
After calculating the nStep, you always use 1. In my case:
nCount := 240
nMax := 100
nStep := 3
but the codeblock is evaluated after every 100 records, only twice.
I think, the right code should be:
bEval := {|| oPgBar:nValue += nStep, .T. }
Please check this issue
Gejza Horvath


Attached files TSTAT.DBF (16.6 KB)Â
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9447
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

TDbfDataSet:AddTag() error

Mensaje por ignacio »

Gejza,
You are completely right. Thank you for your feedback.
Regards,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Gejza Horvath" <_hsoftkn@nextra.sk> escribió en el mensaje
news:[email=466d6817@ozsrv2.ozlan.local...]466d6817@ozsrv2.ozlan.local...[/email]
> Hi guys,
>
> I have reported you a problem with progressbar in AddTag method of the
> TdbfDataSet class 3 weeks ago. Your response was:
>
> "This seems to work correctly"
>
> Yes, it seems to work ok, but in some cases the progressbar is not filled
> to 100%, after the method is finished. Try please this method with
> attached file, which has 240 records.
>
> Looking to the source I found a code, which is wrong in AddTag() method:
>
> IF oPgBar != Nil
> nCount := ::RecCount()
> WITH OBJECT oPgBar
> :nMin := 0
> :nValue := 0
> :nStep := 1
> IF nCount > 100
> nStep := Round( ( nCount / 100) + 0.5, 0 )
> :nMax := 100
> ELSE
> nStep := 1
> :nMax := nCount
> ENDIF
> END WITH
> bEval := {|| oPgBar:nValue += 1, .T. } //!!!! Here is the problem
> !!!!
> ENDIF
>
> After calculating the nStep, you always use 1. In my case:
> nCount := 240
> nMax := 100
> nStep := 3
>
> but the codeblock is evaluated after every 100 records, only twice.
>
> I think, the right code should be:
>
> bEval := {|| oPgBar:nValue += nStep, .T. }
>
>
> Please check this issue
>
> Gejza Horvath
>
>
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Gejza Horvath
Mensajes: 281
Registrado: Mar Ago 15, 2006 1:50 pm

TDbfDataSet:AddTag() error

Mensaje por Gejza Horvath »

Ignazio,
I have tried to rewrite the AddTag method, but the linker miss the COMPILAR() function.
Can you help me ?
Gejza
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9447
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

TDbfDataSet:AddTag() error

Mensaje por ignacio »

Gezja,
Really strange. Is defined on the top of the source file:
#define COMPILAR(cExpr) &("{||" + cExpr + "}")
Regards,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Gejza Horvath" <_hsoftkn@nextra.sk> escribió en el mensaje
news:[email=466d920a@ozsrv2.ozlan.local...]466d920a@ozsrv2.ozlan.local...[/email]
> Ignazio,
>
> I have tried to rewrite the AddTag method, but the linker miss the
> COMPILAR() function. Can you help me ?
>
> Gejza
>
>
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Gejza Horvath
Mensajes: 281
Registrado: Mar Ago 15, 2006 1:50 pm

TDbfDataSet:AddTag() error

Mensaje por Gejza Horvath »

Ignacio,
don't forget to call ProcessMessages() function before Return statement in this method. I
have a reindex routine displaying the actually indexed filename, and using the origin
code, the TLabel object is not refreshed. Calling this function all works fine.
Gejza Horvath
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9447
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

TDbfDataSet:AddTag() error

Mensaje por ignacio »

Gejza,
Automatic call to ProcessMessages() can provoke very annoying efects, for
example, it may let you push a button on a dialog during the reindex
process. Its better that you call the function yourself on the
TProgressBar:OnChange event
Regards,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Gejza Horvath" <_hsoftkn@nextra.sk> escribió en el mensaje
news:[email=466eb656@ozsrv2.ozlan.local...]466eb656@ozsrv2.ozlan.local...[/email]
> Ignacio,
>
> don't forget to call ProcessMessages() function before Return statement in
> this method. I have a reindex routine displaying the actually indexed
> filename, and using the origin code, the TLabel object is not refreshed.
> Calling this function all works fine.
>
>
> Gejza Horvath
>
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Responder