Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a way to seek without moving the record pointer
Message
From
14/11/2001 09:55:12
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00581456
Message ID:
00581466
Views:
16
>Using vfp5...
>
>Is there a function to search a table for a certain record without
>moving the record pointer. At first I thought keymatch but now
>it appears it moves the pointer, indexseek doesn't appear to
>be available till vfp6. I know... upgrade. It's the first thing
>I will do when I'm allow to spend again. I'm not looking forward
>to having to buy vfp7 and VS separatly though. Twice the dough.

Perhaps it helps to re-open the table. This will avoid triggers / record validation functions to fire in the first copy. Perhaps the following lookup function can be of help to you.

HTH, Hilmar.
**********************************************************************
FUNCTION MyLookup(tcAlias, tcOrder, txSeekValue, tcReturnValue, tlEmptyValues)
	* Search in another table. This function solves certain problems with VFP-relations
	* (the problem is that the user only sees new values after a TableUpdate()).
	* The parameter tcReturnValue should be passed as a string that will be evaluated
	* in the function.
	* If the fifth parameter is .T., the function returns an empty field (rather than null)
	*   if the record is not found.
	* For fast re-opening, the table is opened with a special alias, and remains open.

	local lnSelect, llFound, lcAlias
	lnSelect = select()
	lcAlias = tcAlias + "_mylookup"
	if not used(lcAlias)
		use (tcAlias) again alias (lcAlias) in 0
	endif
	select (lcAlias)
	set order to (tcOrder)
	llFound = iif(isnull(txSeekValue), .F., seek(txSeekValue))
	local lxReturnValue
	lxReturnValue = eval(tcReturnValue)	&& This will assign correct type, even if not found
										&& (and final result is NULL)
	if not (llFound or tlEmptyValues)
		lxReturnValue = NULL
	endif
	select (lnSelect)
	return lxReturnValue
ENDFUNC
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform