Página 1 de 1

problem in TDBFBrowse

Publicado: Jue Jul 31, 2008 11:29 am
por Oleg
Dear developers!
I have a problem with TDBFBrowse. I use SET DELETED ON in all my programs.
I try to deal with empty table that has only deleted records.
When I browse this table, first row is always appeared.
When I do oBrowse:Append(), the new record is appended to the second row.
When I do oBrowse:Edit(), the first phantom row is edited.
When I double click on any column of first row, it is edited.
See attached sample.
Is there any way to fix it?
Regards, Oleg

problem in TDBFBrowse

Publicado: Jue Jul 31, 2008 11:31 am
por Oleg
Sorry, I forget to attach my sample.


Attached files test75.zip (2.5 KB)Â

problem in TDBFBrowse

Publicado: Jue Jul 31, 2008 11:31 am
por Oleg
Sorry, I forget to attach my sample.


Attached files test75.zip (2.5 KB)Â

problem in TDBFBrowse

Publicado: Vie Ago 01, 2008 11:03 am
por ignacio
Oleg,
> When I browse this table, first row is always appeared.
As you surely know, the fact that SET DELETED ON is set does not mean you
can not go to a specific deleted record. In fact, when you open a table the
record pointer is positioned on first record, even if is deleted. It is a
good practice to perform a GOTOP after openning the table. Please check if
this is your problem.
I supposse the rest of the errors are part of the first error.
Regards,
--
Ignacio Ortiz de Zúñiga
[Xailer support]
"Oleg" <info@cluster.samara.ru> escribió en el mensaje
news:489185f6$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> Dear developers!
>
> I have a problem with TDBFBrowse. I use SET DELETED ON in all my programs.
> I try to deal with empty table that has only deleted records.
>
> When I browse this table, first row is always appeared.
> When I do oBrowse:Append(), the new record is appended to the second row.
> When I do oBrowse:Edit(), the first phantom row is edited.
> When I double click on any column of first row, it is edited.
>
> See attached sample.
>
> Is there any way to fix it?
>
> Regards, Oleg
>

problem in TDBFBrowse

Publicado: Vie Ago 01, 2008 11:03 am
por ignacio
Oleg,
> When I browse this table, first row is always appeared.
As you surely know, the fact that SET DELETED ON is set does not mean you
can not go to a specific deleted record. In fact, when you open a table the
record pointer is positioned on first record, even if is deleted. It is a
good practice to perform a GOTOP after openning the table. Please check if
this is your problem.
I supposse the rest of the errors are part of the first error.
Regards,
--
Ignacio Ortiz de Zúñiga
[Xailer support]
"Oleg" <info@cluster.samara.ru> escribió en el mensaje
news:489185f6$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> Dear developers!
>
> I have a problem with TDBFBrowse. I use SET DELETED ON in all my programs.
> I try to deal with empty table that has only deleted records.
>
> When I browse this table, first row is always appeared.
> When I do oBrowse:Append(), the new record is appended to the second row.
> When I do oBrowse:Edit(), the first phantom row is edited.
> When I double click on any column of first row, it is edited.
>
> See attached sample.
>
> Is there any way to fix it?
>
> Regards, Oleg
>

problem in TDBFBrowse

Publicado: Vie Ago 01, 2008 11:48 am
por Oleg
Ignacio!
> As you surely know, the fact that SET DELETED ON is set does not mean you
> can not go to a specific deleted record. In fact, when you open a table
> the record pointer is positioned on first record, even if is deleted. It
> is a good practice to perform a GOTOP after openning the table. Please
> check if this is your problem.
>
> I supposse the rest of the errors are part of the first error.
>
My problem still exists (with or without GOTOP after opening).
Please, can you look at my sample and see this problem?
Regards, Oleg

problem in TDBFBrowse

Publicado: Vie Ago 01, 2008 11:48 am
por Oleg
Ignacio!
> As you surely know, the fact that SET DELETED ON is set does not mean you
> can not go to a specific deleted record. In fact, when you open a table
> the record pointer is positioned on first record, even if is deleted. It
> is a good practice to perform a GOTOP after openning the table. Please
> check if this is your problem.
>
> I supposse the rest of the errors are part of the first error.
>
My problem still exists (with or without GOTOP after opening).
Please, can you look at my sample and see this problem?
Regards, Oleg

problem in TDBFBrowse

Publicado: Dom Ago 03, 2008 3:41 pm
por ignacio
Oleg,
I saw the problem, but does not have an easy fix on our part. Let me
explain:
The browse needs to know how many records are visible. For speed reasons the
record counting is done with the classic ORDKEYCOUNT() function. But this
function includes deleted records, but can easily be fixed including the
expression !DELETED() on the FOR clause of the index.
Another chance is to overload the event TDbfBrowse:OnKeyCount(). For
example:
::oDbfBrowse1:OnKeyCount := {|| MyCount( ) }
FUNCTION MyCount()
LOCAL nCount, nRecno
nCount := 0
nRecno := ::Recno()
DbGoTop()
DbEval( {|| nCount ++ } )
DbGoTo( nRecno )
RETURN nCount
BTW, this can be very slow with large databases
Another chance is to use Datacontrols: a TDbfDataset and and TDBBrowse. And
on the dataset set the property lKeyExact to .T. which indeed performs the
same operation as described in second solution.
Regards,
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Oleg" <info@cluster.samara.ru> escribió en el mensaje
news:4892dbcd$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> Ignacio!
>
>> As you surely know, the fact that SET DELETED ON is set does not mean you
>> can not go to a specific deleted record. In fact, when you open a table
>> the record pointer is positioned on first record, even if is deleted. It
>> is a good practice to perform a GOTOP after openning the table. Please
>> check if this is your problem.
>>
>> I supposse the rest of the errors are part of the first error.
>>
>
> My problem still exists (with or without GOTOP after opening).
> Please, can you look at my sample and see this problem?
>
> Regards, Oleg
>

problem in TDBFBrowse

Publicado: Dom Ago 03, 2008 3:41 pm
por NoName
Oleg,
I saw the problem, but does not have an easy fix on our part. Let me
explain:
The browse needs to know how many records are visible. For speed reasons the
record counting is done with the classic ORDKEYCOUNT() function. But this
function includes deleted records, but can easily be fixed including the
expression !DELETED() on the FOR clause of the index.
Another chance is to overload the event TDbfBrowse:OnKeyCount(). For
example:
::oDbfBrowse1:OnKeyCount := {|| MyCount( ) }
FUNCTION MyCount()
LOCAL nCount, nRecno
nCount := 0
nRecno := ::Recno()
DbGoTop()
DbEval( {|| nCount ++ } )
DbGoTo( nRecno )
RETURN nCount
BTW, this can be very slow with large databases
Another chance is to use Datacontrols: a TDbfDataset and and TDBBrowse. And
on the dataset set the property lKeyExact to .T. which indeed performs the
same operation as described in second solution.
Regards,
--
Ignacio Ortiz de Zúñiga
[Soporte Xailer]
[Xailer support]
"Oleg" <info@cluster.samara.ru> escribió en el mensaje
news:4892dbcd$[email=1@ozsrv2.ozlan.local...]1@ozsrv2.ozlan.local...[/email]
> Ignacio!
>
>> As you surely know, the fact that SET DELETED ON is set does not mean you
>> can not go to a specific deleted record. In fact, when you open a table
>> the record pointer is positioned on first record, even if is deleted. It
>> is a good practice to perform a GOTOP after openning the table. Please
>> check if this is your problem.
>>
>> I supposse the rest of the errors are part of the first error.
>>
>
> My problem still exists (with or without GOTOP after opening).
> Please, can you look at my sample and see this problem?
>
> Regards, Oleg
>

problem in TDBFBrowse

Publicado: Lun Ago 04, 2008 9:28 am
por Oleg
Ignacio,
> I saw the problem, but does not have an easy fix on our part. Let me
> explain:
>
> The browse needs to know how many records are visible. For speed reasons
> the record counting is done with the classic ORDKEYCOUNT() function. But
> this function includes deleted records, but can easily be fixed including
> the expression !DELETED() on the FOR clause of the index.
>
Thank you for the explanation. I will try to work around it by one of these
ways.
Regards, Oleg

problem in TDBFBrowse

Publicado: Lun Ago 04, 2008 9:28 am
por Oleg
Ignacio,
> I saw the problem, but does not have an easy fix on our part. Let me
> explain:
>
> The browse needs to know how many records are visible. For speed reasons
> the record counting is done with the classic ORDKEYCOUNT() function. But
> this function includes deleted records, but can easily be fixed including
> the expression !DELETED() on the FOR clause of the index.
>
Thank you for the explanation. I will try to work around it by one of these
ways.
Regards, Oleg