Link to home
Start Free TrialLog in
Avatar of syloux
syloux

asked on

Compare string in a memo, for filtering

I have a paradox table with a memo.  I need to find records containing a certain text in the memo.
I'm using a OnFilterRecord to do that.

Procedure TDataModule1.Table1FilterRecord(DataSet: TDataSet; var Accept: Boolean);
Begin
 Accept := Pos('Hello world', Table1.Memo.Text) ;
End ;

But it do not work.  I have an error message telling the memo can not be access in a filter.
How can I do that ???

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of nnbbb09
nnbbb09

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mohammed Nasman
Hello

Try sametext funcation

Procedure TDataModule1.Table1FilterRecord(DataSet: TDataSet; var Accept: Boolean);
Begin
Accept := SameText('HelloWorld',Table1['urField'])
End ;

Best regards
Mohammed Nasman
Avatar of syloux
syloux

ASKER

Always have this error message :

Cannot access field 'Memo' in a filter  :(((

if  nnbbb09 comment not work, then it could be impossible,
except you don't have replaced 'Memo' with your real fieldname

but, maybe this helps, (just modified nnbbb09 comment, not tested)
Begin
  Accept := Pos('Hello world', TBlobField(Table1.FieldByName('Memo')).AsString) > 0 ;
End ;

meikl ;-)
I just tested  nnbbb09 comment and it works fine.
Created a form a table a source a grid and a button.
The grid displays the COMPONENTTYPE Field of the table.
When you turn on the filter only the Records in the
table that have 'COMPUTER' in them show.

*******************************************************
procedure TForm1.Table1FilterRecord(DataSet: TDataSet;
  var Accept: Boolean);
begin
  Accept := Pos('COMPUTER', Table1COMPONENTTYPE.Value) > 0;
end;
******************************************************
procedure TForm1.Button1Click(Sender: TObject);
begin
  Table1.Open;
  Table1.Filtered := True;
  Table1.Refresh;
end;
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept nnbbb09's comment as answer

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Thank you,
Russell

EE Cleanup Volunteer