Searcing without moving record pointer

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Searcing without moving record pointer

Post by sudip »

Hi,

Can anyone help me to search a lookup table (say Item) without moving record pointer of lookup table?

Regards.

Sudip
With best regards,
Sudip
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Searcing without moving record pointer

Post by esgici »

sudip wrote:Hi,

Can anyone help me to search a lookup table (say Item) without moving record pointer of lookup table?

Regards.

Sudip
Hi Sudip

I am afraid that I can't understand your question.

By definition, only one record can be active at a time in a table. When you begin a lookup ( by FIND, SEEK, LOCATE, CONTINUE or anything else) record pointer will change to searched record if found, else to LASTREC() + 1. This is logic of lookup, it isn't?

If you want don't lose record pointer before lookup, you can store it into a variable.

I don't know this help to you.

Regards

--

Esgici
Viva INTERNATIONAL HMG :D
User avatar
sudip
Posts: 1454
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: Searcing without moving record pointer

Post by sudip »

Hi Esgici,

Thank you for your help.

I am now telling the particular problem, why I need this.

It is required for foreign key data integrity. Suppose sale table has a foreign key for customer code. Our user is using the sale form. Now he/she opens customer setup form, where he tries to delete a customer from customer master file, which was setup erroneously. Before deletion, software should look up foreign key reference of sale table. But, in this case sale table record pointer will be moved from the previous location and sale form will face problem.

Now how to solve this.
1) Sale Form: Using memory variable for each field and during update/refresh it will seek the primary key of the sale table.
2) Customer Form: Before looking up to sale table, sale record number should be stored in a temporary variable and after search is over move record pointer of sale table to previous location.

Now for 2nd case, it will be very helpful if record pointer is not moved.

BTW, is there any way to open private data session for a form? I got this idea from another software tool (VFP). (I know many of our friends have allergy about Microsoft, but it's a good feature ;) )

With best regards.

Sudip
With best regards,
Sudip
Post Reply