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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RECORDNO IN PARADOX TABLES!

Status
Not open for further replies.

selena1

Programmer
Joined
Apr 7, 2003
Messages
69
I use a Paradox database. I want to specify what is record number in some dataset. I use properties RecordNo and RecordCount, and component Label:

Label1.Caption := 'Record ' + IntToStr(Table1.RecNo) + ' of ' + IntToStr(Table1.RecordCount);

Trouble is when I retrieve some recordst from the table, using Filter property, and scroll between records. In that case, property RecordNo has value of physical position record in the complete table. So, I can't get correct result.
For example: if set Filter property on some value and as a result get 5 records (records: 2,3,4,8,10) from the table that have 10 records as a result I can get:

Record 8 of 5.

Correct is:

Record 4 of 5.

How can I solve this trouble?
THANKS!
 
Selena1,

You have two choices:

1. Replace your Filters with Ranges. Both RecordNumber and RecordCount only work with Ranges.

2. "Walk" the filtered dataset to manually count the matches before the rest of your processing. Depending on your configuration and setup, this can take some time or it may take little time at all.

While the second approach might seem more workable in the short term, you're best long term approach is the first option.

Hope this helps...

-- Lance
 
One more thing to realize: relational tables have no record numbers. They are sets of rows, often ordered by their column data.

Does the user really need to have a record number? What are they going to do with that information?

Cheers
 
For identification it is very handy to have unique number, that can be used as a keyfield, or a look-up field to establish relationships. But back to what selena is looking for, walking the database and using a counter would be the correct option.

Steven van Els
SAvanEls@cq-link.sr
 
Steven,

Hm. I'm not so sure that's the "right" option, though it's certainly a legitimate one. Depending on the size of the underlying tables and where they're located, it may be better to reduce network traffic by replacing the filters with ranges. That limits transmission to the secondary index and not the entire table; it also returns the full set of restricted records.

Now, it's entirely possible the filter criteria cannot be expressed in a range. In that case, then filters are probably the best approach.

As with most cases in this business, the right answer is, "It Depends." :-)

Hope this helps...

-- Lance
 
There are a lot of ways that lead to Rome

Especially in programming

Steven van Els
SAvanEls@cq-link.sr
 
I had some more suggestions (to use two tables components, one as temporary, with correct results).
But, because I have a relativly smoll tables, looks to me that the best approach is to manually count records.
Can anybody get me some code for this?

THANKS!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top