delete last record and eof() 
Author Message
 delete last record and eof()

Hi everyone,

If I delete the last record in a Paradox table, the ttable.eof property
remains false. Does anyone know an elegant workaround (I already found an
inelegant one).

Bye,
Jan

-----------------------------------------------------------------------

P.O. Box 697              2300 RA  Leiden            The Netherlands
-----------------------------------------------------------------------
** Specialists in multimedia software for education and presentation **
-----------------------------------------------------------------------
Usage of this email address for commercial purposes costs US$ 50 per
message. By using this email address you agree to this condition.
-----------------------------------------------------------------------



Wed, 18 Jun 1902 08:00:00 GMT  
 delete last record and eof()
  Just curious, why?  (being nosy is the bes way to find out what someone is
trying do...)   :)

  In the meantime, you could use RecNo and RecordCount (but I don't know
what would happen after a delete...  You'd have to experiment....)

--

Jason Wallace
SL Software

--
"We are Microsoft.  Resistance is Futile.  You will be Assimilated"
--

Quote:

>Hi everyone,

>If I delete the last record in a Paradox table, the ttable.eof property
>remains false. Does anyone know an elegant workaround (I already found an
>inelegant one).

>Bye,
>Jan

>-----------------------------------------------------------------------

>P.O. Box 697              2300 RA  Leiden            The Netherlands
>-----------------------------------------------------------------------
>** Specialists in multimedia software for education and presentation **
>-----------------------------------------------------------------------
>Usage of this email address for commercial purposes costs US$ 50 per
>message. By using this email address you agree to this condition.
>-----------------------------------------------------------------------



Wed, 18 Jun 1902 08:00:00 GMT  
 delete last record and eof()
TTable.Refresh after the delete works on dBase files for the same
problem with D3 (if you use TTable.Delete).
I couldn't find a solution when deleting the record from another object
(query or so ...).

Carsten

Gettin' rich with emails ... that's not the worst way ;)

Quote:
> If I delete the last record in a Paradox table, the ttable.eof property
> remains false. Does anyone know an elegant workaround (I already found an
> inelegant one).

> Bye,
> Jan



Wed, 18 Jun 1902 08:00:00 GMT  
 delete last record and eof()
What about ((ttable.eof = True) AND (ttable.bof = True) AND
(ttable.recordcount <=0)) ?
Quote:

>Hi everyone,

>If I delete the last record in a Paradox table, the ttable.eof property
>remains false. Does anyone know an elegant workaround (I already found an
>inelegant one).

>Bye,
>Jan

>-----------------------------------------------------------------------

>P.O. Box 697              2300 RA  Leiden            The Netherlands
>-----------------------------------------------------------------------
>** Specialists in multimedia software for education and presentation **
>-----------------------------------------------------------------------
>Usage of this email address for commercial purposes costs US$ 50 per
>message. By using this email address you agree to this condition.
>-----------------------------------------------------------------------



Wed, 18 Jun 1902 08:00:00 GMT  
 delete last record and eof()
So, what's the problem with that?
Eof means position-at-the-end-of-file=after-last-record.
Delete allways repositions to previous record.

--
----------------------
Regards
Robert Cerny
Remove both qwe when replying

No questions via email, unless explicitly invited.

Quote:

>What about ((ttable.eof = True) AND (ttable.bof = True) AND
>(ttable.recordcount <=0)) ?


>>Hi everyone,

>>If I delete the last record in a Paradox table, the ttable.eof property
>>remains false. Does anyone know an elegant workaround (I already found an
>>inelegant one).

>>Bye,
>>Jan



Wed, 18 Jun 1902 08:00:00 GMT  
 delete last record and eof()

Quote:
(Carsten Ralle) writes:

>TTable.Refresh after the delete works on dBase files for the same
>problem with D3 (if you use TTable.Delete).
>I couldn't find a solution when deleting the record from another object
>(query or so ...).

Too bad, is doesn't work with a Paradox table under D1.

Bye,
Jan
-----------------------------------------------------------------------

P.O. Box 697              2300 RA  Leiden            The Netherlands
-----------------------------------------------------------------------
** Specialists in multimedia software for education and presentation **
-----------------------------------------------------------------------
Usage of this email address for commercial purposes costs US$ 50 per
message. By using this email address you agree to this condition.
-----------------------------------------------------------------------



Wed, 18 Jun 1902 08:00:00 GMT  
 delete last record and eof()

Quote:

>So, what's the problem with that?
>Eof means position-at-the-end-of-file=after-last-record.
>Delete allways repositions to previous record.

I know how Delete behaves ;-)
The problem is that I have a loop that either skips or deletes a record until
eof.
But *if* the last record gets deleted, with the delete behaviour as it is, I
cannot detect the eof. The code essentially removes duplicates, and if e.g.
the last records are (only 1 field for the example):
Y
Z
Z
Z

*all * Z's get removed.

I found a workaround by counting the number of records skipped and the number
skipped.
Other solutions like
  refresh
or
  try
    next
    prev
  except
end

didn't work either.

-----------------------------------------------------------------------

P.O. Box 697              2300 RA  Leiden            The Netherlands
-----------------------------------------------------------------------
** Specialists in multimedia software for education and presentation **
-----------------------------------------------------------------------
Usage of this email address for commercial purposes costs US$ 50 per
message. By using this email address you agree to this condition.
-----------------------------------------------------------------------



Wed, 18 Jun 1902 08:00:00 GMT  
 delete last record and eof()
Are you able to, and have you tried reversing the direction of your loop,
i.e. start with the last record and work to the first, testing for BOF
instead of EOF.

Quote:



>>So, what's the problem with that?
>>Eof means position-at-the-end-of-file=after-last-record.
>>Delete allways repositions to previous record.

>I know how Delete behaves ;-)
>The problem is that I have a loop that either skips or deletes a record
until
>eof.
>But *if* the last record gets deleted, with the delete behaviour as it is,
I
>cannot detect the eof. The code essentially removes duplicates, and if e.g.
>the last records are (only 1 field for the example):
>Y
>Z
>Z
>Z

>*all * Z's get removed.

>I found a workaround by counting the number of records skipped and the
number
>skipped.
>Other solutions like
>  refresh
>or
>  try
>    next
>    prev
>  except
>end

>didn't work either.

>-----------------------------------------------------------------------

>P.O. Box 697              2300 RA  Leiden            The Netherlands
>-----------------------------------------------------------------------
>** Specialists in multimedia software for education and presentation **
>-----------------------------------------------------------------------
>Usage of this email address for commercial purposes costs US$ 50 per
>message. By using this email address you agree to this condition.
>-----------------------------------------------------------------------



Wed, 18 Jun 1902 08:00:00 GMT  
 delete last record and eof()

Quote:

>Are you able to, and have you tried reversing the direction of your loop,
>i.e. start with the last record and work to the first, testing for BOF
>instead of EOF.

Hey, that's an interesting ide. I won't do that now, because I have a
workaround, but it could come in handy next time.  

How about performance though - would there be a difference between going
forward and backward? That should be easy to test when teh time comes...

Bye,
Jan

-----------------------------------------------------------------------

P.O. Box 697              2300 RA  Leiden            The Netherlands
-----------------------------------------------------------------------
** Specialists in multimedia software for education and presentation **
-----------------------------------------------------------------------
Usage of this email address for commercial purposes costs US$ 50 per
message. By using this email address you agree to this condition.
-----------------------------------------------------------------------



Wed, 18 Jun 1902 08:00:00 GMT  
 delete last record and eof()
I haven't done any timing tests but theoretically there should be no
difference.
Quote:



>>Are you able to, and have you tried reversing the direction of your loop,
>>i.e. start with the last record and work to the first, testing for BOF
>>instead of EOF.

>Hey, that's an interesting ide. I won't do that now, because I have a
>workaround, but it could come in handy next time.

>How about performance though - would there be a difference between going
>forward and backward? That should be easy to test when teh time comes...

>Bye,
>Jan

>-----------------------------------------------------------------------

>P.O. Box 697              2300 RA  Leiden            The Netherlands
>-----------------------------------------------------------------------
>** Specialists in multimedia software for education and presentation **
>-----------------------------------------------------------------------
>Usage of this email address for commercial purposes costs US$ 50 per
>message. By using this email address you agree to this condition.
>-----------------------------------------------------------------------



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. EOF returns true before accessed last record (Delphi 1)

2. Delete & EOF on detail tables

3. DBASE: permanently deleting deleted records

4. adding/deleting records from array of records in .dat file

5. Finding last added record?

6. retreining the last inserted record from a table

7. Can't find last record added with lookup

8. iobjects and last inserted records key.

9. EOF of TQuery: how to distinguish between empty dataset and Last row?

10. I'm stuck and need advise - cannot fix Record/Key Deleted

11. data aware grid and table - record/key deleted

12. How to delete record without prompt message?

 

 
Powered by phpBB® Forum Software