Solved

Search a memo using onfilterrecord

Posted on 2000-02-29
10
197 Views
Last Modified: 2010-04-04
Hi,

I am using DBISAM as a BDE replacement and need to be able to search for text within a memo. I have been told that using onfilterrecord works, but my attempts to implement it have failed so far.

How to you do this?

Onfilterevent...

Accept:???

Thanks

John
0
Comment
Question by:JohnE
  • 4
  • 2
  • 2
  • +2
10 Comments
 
LVL 12

Expert Comment

by:rwilson032697
Comment Utility
You should be able to do this:

procedure TForm1.Table1FilterRecord(DataSet: TDataSet; var Accept: Boolean);

begin
  Accept := Pos('The string to search for', DataSet['TheMemoField']) > 0;
end;

Cheers,

Raymond.
0
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
i guess that is not possible :-(
0
 
LVL 15

Expert Comment

by:simonet
Comment Utility
What about using the LIKE keyword:

SELECT * FROM TABLE1 WHERE FIELDX LIKE '%partial string%'

(I just can't remember if it is '%' or '*' for the LIKE comparision).

Yours,

Alex
0
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
alex, i guess this will also not work for blobs
0
 
LVL 17

Expert Comment

by:inthe
Comment Utility
Var
SearchCode: String;
 
procedure TForm1.Table1FilterRecord(DataSet: TDataSet;var Accept: Boolean);
  begin
Accept := (AnsiStrLIComp(PChar(Table1MemoField.AsString),         PChar(SearchCode), Length(SearchCode)) = 0);
  end;


ps alex your correct already its percent (though im not sure if it is
 '%searchcode%' or 'searchcode%' ;-)
0
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

 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
its % for sql-statement-where-clause
its * for filters, where it can only be appended

to barry,
i guess this does not work,
had tested it similar (not with a persistent field)
and get the error: Cannot access Field ... on Filter (or similar)
did you tested it?
i guess no, then you had post an answer :-))
meikl
0
 

Author Comment

by:JohnE
Comment Utility
Raymond's answer works great. Is there a way to make it case insensitive?

Thanks

John
0
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
i guess i was wrong ;-)
0
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 100 total points
Comment Utility
How about this:

procedure TForm1.Table1FilterRecord(DataSet: TDataSet; var Accept: Boolean);

begin
  Accept := Pos(UpperCase('The string to search for'), UpperCase(DataSet['TheMemoField'])) > 0;
end;

You could factor out the uppercase-ing of the search string to make it a little faster...

Cheers,

Raymond.

0
 

Author Comment

by:JohnE
Comment Utility
Thanks Raymond - works perfectly!
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 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

10 Experts available now in Live!

Get 1:1 Help Now