?
Solved

Search Memo on filtered database

Posted on 2002-03-25
2
Medium Priority
?
157 Views
Last Modified: 2010-04-04
I am using Topaz V7.51 BDE replacement (www.softsci.com)

The software has a procedure to search on a memo field for a string -
 
LocateRec(FieldName:string; var FieldValue);

e.g.
.....
var
 MyString: string;
begin
 MyString := 'A Company';
 MyTable.LocateRec('COMPANY', MyString);
......

if the search string is found a call to another

procedure Continue;

e.g.
.....
 MyTable.Continue;
.....

resumes the search for another occurance of the string. This can be called repeatedly until the end of the database is reached.
The problem is that the procedure does not respect filters and i wish to search on filter ranges. I have found an undocumented function used internally by Topaz to detect if the current record is in the filter range.

function RecordInFilterRange: Boolean

I wish to use this to detect if a matching string is in the filter range, If it is in the filter range stop then a call can be made to Continue or if it is not ignore it and continue to the next match etc. I wish to use 2 buttons (Locate & Continue) to achieve this functionality.
 Any help would be appreciated.

Regards
Paul.  
0
Comment
Question by:pr_wainwright
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
geobul earned 600 total points
ID: 6896431
Hi,
Something like:

// locates first record within a range
// returns true = found and false = not found
function LocateRecFiltered(TheTable: TypeOfMyTable; FieldName:string; var FieldValue): boolean;
begin
 result := false;
 try
  with TheTable do begin
   LocateRec(FieldName, FieldValue);
   if not EOF then begin
    while (not EOF) and (not RecordInFilterRange) do begin
      Continue;
    end;
    if not EOF then result := true;
   end;
  end;
 except
  result := false;
 end;
end;

// continues searching
// returns true = found and false = not found
function ContinueFiltered(TheTable: TypeOfMyTable): boolean;
begin
 result := false;
 try
  with TheTable do begin
   Continue;
   if not EOF then begin
    while (not EOF) and (not RecordInFilterRange) do begin
      Continue;
    end;
    if not EOF then result := true;
   end;
  end;
 except
  result := false;
 end;
end;

Usage:
// Locate button
procedure TForm1.Button1Click(Sender: TObject);
begin
  if not LocateRecFiltered(MyTable, 'COMPANY', Edit1.Text) then ShowMessage('Record not found');
end;

// Continue button
procedure TForm1.Button2Click(Sender: TObject);
begin
  if not ContinueFiltered(MyTable) then ShowMessage('There are no more records found');
end;

Replace 'TypeOfMyTable' with the actual type in both function definitions. I presume that there are MyTable.EOF property and MyTable.RecordInFilterRange method.

Regards, Geo
0
 
LVL 1

Author Comment

by:pr_wainwright
ID: 6898714
Just the trick !
Thanks
Paul.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

718 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