It's not a secret anymore!*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes How can I get the record number? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "How can I get the record number?" Watch "How can I get the record number?" New topic
Author

How can I get the record number?

long lingyu
Ranch Hand

Joined: Feb 15, 2004
Posts: 51
I don't know because if there is a deleted record, I can't cal the record number. My method is the (db_file_length-header_length)/One_record_length.
Satish Avadhanam
Ranch Hand

Joined: Aug 12, 2003
Posts: 697
Hi long, it would be easy if you can explain the problem situation in more detail. I could not understand what you asked. Sorry.
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
I think you want to do this, rite?
Originally:

I think you want the display to be this:

You can still get the record number, but that record is being mark as deleted.
One thing you can do is (what I have done) you do NOT shift the record number. I keep the original display, but I do not allow the deleted record to be displayed. In addition, I hide the record number column, so that the user feel observationally equivalent between the 2 displays.
Since I think the user dont care whether they know the record number, as they need to highlight the record to have a booking, and thus, I simply hide it, rather than displaying it out, and *reconstruct* the numbering.
Nick.


SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
Mark Smyth
Ranch Hand

Joined: Feb 04, 2004
Posts: 288
I agree I dont think that all active record numbers should have do be sequential, in fact if you didn't count the delected records it would make random access impossible IMHO.


SCJP<br />SCJD
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How can I get the record number?
 
Similar Threads
B&S: What is the Value used for RecNo
NX No Primary key ?
Dealing with Deleted Records
urlybird 1.1.1 (int recNo)
Records