Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bad Deleted Flags?

Status
Not open for further replies.

jjjt

Technical User
Sep 15, 2002
34
GB
For example:

We have a table with 10 records in, 3 are flagged for deletion (the little black mark when browsing a table). However the index reports 4 are deleted (We have an index on DELETED()) and as far as we are concerned this is correct because:

1. It is in line with what our code should be doing (in other words we are expecting to see 4 deleted records)
2. If we SET DELETED ON in VFP and browse the table we can see 6 records and NOT 7.

However if we do a REINDEX or a PACK only 3 records are removed from the table and we now see 7 records when we browse the table with SET DELETED ON.

This is happening to many of our clients on the same table and we are having trouble isolating the cause.

How can a record in a table not register it has been deleted? (When the index has registered it has been deleted)
 
It sounds like the index is corrupt... exactly how do you have it indexed for deleted()?

Is it something like:
Code:
 index on iif(deleted(),"Y","N") tag MyDeleted

Is the index a structural one (i.e. it's opened automatically when the table is) or an external one?

Regards

Griff
Keep [Smile]ing
 
We feel the index is correct and the table is wrong.

Because browsing with SET DELETED ON does not show these rogue records but browsing with SET DELETED OFF shows them but with no deleted mark on them.

We feel the records should be shown with a deleted mark against the record when browsing with SET DELETED OFF but for some reason they are not.

We use a CDX index on "DELETED()"



 
Hi,

I have never indexed a table on a logical value the way you are (the deleted() function returning a logical).

Is it possible for you to reindex the table in the manner I suggested and rerun your program?

I suppose the table could be corrupt - you could verify by deleting it and recreating it - but it is somewhat unlikely.

Martin

Regards

Griff
Keep [Smile]ing
 
Binary keys (including DELETED()) have always been problematic, and this is one reason VFP 9.0 now has a new index type (BINARY). It's stored more efficiently so the indexes are smaller and quicker.

Rick
 
As I recall the deleted flag is an asterisk in the beginning of the record. Actually, it's the first real field in the record. If you feel the deleted flag or field is corrupt, then SET DELETED OFF and LIST or DISPLAY the file. (Or do FILETOSTRING("table.dbf") and take a look at it. You should see an asterisk at the beginning of every deleted record.

I know that if CHR(0) gets into the deleted flag, your table is truly corrupted and can behave really weird!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top