<< Click to Display Table of Contents >> Navigation: Apollo VCL Components > Apollo VCL Component Reference > TApolloEnv > TApolloEnv Methods > SetSoftSeek |
Declaration
procedure SetSoftSeek( const Value: WordBool );
Description
Indicates whether or not index seeks that result in failure (i.e., the requested key value does not match any key in the index order either partially or exactly) should result in a successful conclusion if a key is found that is immediately greater than the requested key.
This is a global system setting that affects all index seeks once it is turned on.
Parameters
If True, then soft seeks are performed for all files in the current task. The soft seek setting is global in this respect.
SetSoftSeek is normally only turned on when necessary, and then turned off immediately after performing Seek.
See Seek for details as to its behavior when SetSoftSeek is set to True.
Delphi Example
// Found can be used when SoftSeek is True to determine whether the record found is a match or the result of finding a record after the requested key.
procedure Form1.Button1Click(Sender: TObject);
var
cRecStr: String;
begin
// Get SEEK value from user
sRecStr := SeekBox.Text;
if sRecStr = '' then
Exit;
sRecStr := UpperCase( sRecStr );
ApolloEnv1.SetSoftSeek( True );
if ApTbl.Seek( sRecStr ) then
begin
if Found then
ShowMessage( 'Exact or partial match!' )
else
ShowMessage( 'Soft seek - on record after' );
end
else
ShowMessage( 'Key Not Found' );
ApolloEnv1.SetSoftSeek( False );
end;
See Also