Solved

Search a memo using onfilterrecord

Posted on 2000-02-29
10
200 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
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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

 
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 100 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

Title # Comments Views Activity
indy Tmemory stream non latin charcter issue 2 121
Delphi : could not find program, '...exe' 2 191
Delphi inherited method 6 75
how can i search if string exist in array ? 3 63
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

790 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