Solved

Problems with jumping to a specific record

Posted on 1997-09-02
5
171 Views
Last Modified: 2012-05-04
Hi!!
I have some problems finding a procedure with wich you can jump to a specific record-number in a table, like this:

DM1.Table1.XXXX[5];
(Where I want to jump to record number five..)

I looked at GotoKey, Find and the rest of them, however they all need information other than just the record-number.

I use Delphi Developer 2.0 and the table is a Paradox-base.

Thanx!
Erik N
0
Comment
Question by:Erik N
  • 2
  • 2
5 Comments
 
LVL 3

Expert Comment

by:mirek071497
ID: 1343400
What you mean with Jump ?
You need read data of this record, delete or any other ?
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 15 total points
ID: 1343401
Hi Erik N,

There exists a procedure MoveBy(Distance: integer) :

The MoveBy method moves the dataset cursor by Distance records. If Distance is negative, the move is backward. If Distance is positive, the movement is forward. If Distance is zero, no move is done. MoveBy returns the number of records that were traversed.

You can use this procedure to go to the fifth record in a table.
Do it like this :

DM1.Table1.First; { Go to the first record }
DM1.Table1.MoveBy(+5); { Go to the fifth record }

So, make a function :

function MoveTo(RecordPos: Integer):Integer;
begin
 with DM1.Table1 do begin
  First;
  Result := MoveBy(RecordPos);
 end;
end;

If you need it to work on different tables :

function MoveTo(OnTable:TTable;RecordPos:integer):integer;
begin
 with OnTable do begin
  First;
  Result := MoveBy(RecordPos);
 end;
end;
 
OffCourse you better improve these functions with error checking!

Have fun,
c.u. ZifNab;

Questions, just ask!
0
 

Author Comment

by:Erik N
ID: 1343402
Thank you ZifNab, for your excellent answer!
I really appreciate it..
Erik N
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1343403
Glad I could help you,

Does it works like you wanted it?
Sad that you always have to go to the first record isn't it?

Have fun,
c.u. ZifNab;
0
 

Author Comment

by:Erik N
ID: 1343404
I agree ! It´s sad, but it doesn´t really matter..
I will give you the Points for this later on...
Erik N
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now