Old 25th January 2012, 09:46 AM
denisprince denisprince is offline
Junior Member
Join Date: Aug 2011
Posts: 12
Default RecordCount 0, IsEmpty false

D2007. NexusDB 3.09

I have a situation where i delete records in a table using a cursor and then check with another cursor on the same table but using a different index and a range if the table is empty. It seems that this way of deleting records makes IsEmpty not reliable since i have a recordcount of 0 and IsEmpty false.

TB1 has one record.

TB1.Delete; // index A

TB2.SetRange([Key],[Key]); // index B

Here TB2.RecordCount = 0 which is correct but TB2.IsEmpty is false.

If i move the cursor after TB2.SetRange by issuing a TB2.First then IsEmpty returns true. ( Somehow i thought that SetRange was doing an implicit First )

Is this wad or something wrong with my code?

If i move the cursor after TB2.SetRange by issuing a TB2.First then IsEmpty returns true.

I uploaded a little project in the binaries (CheckIsEmpty.zip) that reproduces this.

Denis Prince
Old 27th January 2012, 10:34 PM
Denis Prince
Posts: n/a
Default Re: RecordCount 0, IsEmpty false

I get the same results with FlashFiler 2.53.

To show this I create a table Test.nx1 with 2 fields: A shortstring 10,
B integer.

Sequential access, NoIdx (Field: No), NameIdx ( Field Name)

2 records :

'A' 1
'B' 1

2 cursors

TB1 indexname ''
TB2 indexname NoIdx


if TB1.IsEmpty then // table still has 1 record left


if TB1.IsEmpty then // table has no record left (TB1.Recordcount = 0)
Exit; // never gets called because IsEmpty is false

In this case (TB1.Recordcount = 0) is more reliable then TB1.IsEmpty.

Denis Prince

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
RecordCount 0, IsEmpty false denisprince Binaries 0 25th January 2012 09:42 AM
IsEmpty vs RecordCount jprenou nexusdb.public.support 2 9th November 2010 09:22 AM
TR/ATRAPS.Gen false ? Ad Franse nexusdb.public.discussions 3 1st January 2010 02:15 AM
assign false as Defaultvalue Jago Post nexusdb.public.support 2 21st August 2006 10:09 PM
isempty set eof to true ? Roberto Nicchi nexusdb.public.support 2 6th November 2003 06:30 AM

All times are GMT +11. The time now is 02:17 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.