Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Search a memo using onfilterrecord

Posted on 2000-02-29
10
Medium Priority
?
206 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
[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
  • 4
  • 2
  • 2
  • +2
10 Comments
 
LVL 12

Expert Comment

by:rwilson032697
ID: 2571649
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
ID: 2571826
i guess that is not possible :-(
0
 
LVL 15

Expert Comment

by:simonet
ID: 2572048
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 27

Expert Comment

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

Expert Comment

by:inthe
ID: 2573777
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
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2573892
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
ID: 2574220
Raymond's answer works great. Is there a way to make it case insensitive?

Thanks

John
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2574245
i guess i was wrong ;-)
0
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 400 total points
ID: 2574289
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
ID: 2574334
Thanks Raymond - works perfectly!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
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

670 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