Board index » delphi » TTable.Filter expression with Memo fields?

TTable.Filter expression with Memo fields?


2004-01-22 11:53:29 PM
delphi23
Is it possible to use (Paradox) MemoFields in a filter of TTable?
With Filter:= 'MyMemoField = ''SomeString''' (at Design Time) I get
the error message 'type mismatch'.
felix
 
 

Re:TTable.Filter expression with Memo fields?

I haven't tried it, but you might be able to use the OnFilterRecord event
handler to look at the memo field and filter the table that way. Something
like this:
procedure TMyForm.Table1FilterRecord(DataSet: TDataSet; var Accept:
Boolean);
begin
Accept := pos('string', DataSet.FieldBYName('MemoField'))>0
end;
You'll set the Filtered property of the table, but leave the Filter property
blank.
-Dell
 

Re:TTable.Filter expression with Memo fields?

Felix Porsch writes:
Quote
With Filter:= 'MyMemoField = ''SomeString''' (at Design Time) I get
the error message 'type mismatch'.
Type Mismatch of what? The code you show should be okay.
--
Nick Hodges (TeamB)
Lemanix Corporation - (www.lemanix.com)
Improve the quality of Delphi! Get your bugs into QC:
qc.borland.com
 

Re:TTable.Filter expression with Memo fields?

Use single quotes in the Filter
"Felix Porsch" <XXXX@XXXXX.COM>writes
Quote
Is it possible to use (Paradox) MemoFields in a filter of TTable?
With Filter:= 'MyMemoField = ''SomeString''' (at Design Time) I get
the error message 'type mismatch'.

felix

 

Re:TTable.Filter expression with Memo fields?

Dell Stinnett schrieb:
Quote
I haven't tried it, but you might be able to use the OnFilterRecord event
handler to look at the memo field and filter the table that way. Something
like this:

procedure TMyForm.Table1FilterRecord(DataSet: TDataSet; var Accept:
Boolean);
begin
Accept := pos('string', DataSet.FieldBYName('MemoField'))>0
end;

You'll set the Filtered property of the table, but leave the Filter property
blank.
Yes, that might work, but it is static.
This way, I can not change the filter at run time. For that I have to
derive
a new table type which uses properties and an internal filter operation.
felix
 

Re:TTable.Filter expression with Memo fields?

"Nick Hodges (TeamB)" schrieb:
Quote
Felix Porsch writes:

>With Filter:= 'MyMemoField = ''SomeString''' (at Design Time) I get
>the error message 'type mismatch'.

Type Mismatch of what? The code you show should be okay.
The error message simply tells me 'Fehlende Typübereinstimmung im
Ausdruck' (Type mismatch in expression). Nothing more.
It appears (at design time) with the filter expression above when
Table.active = true, regardless of the state of Table.Filtered.
It also appears when no MyMemoField has a NULL value.
felix
 

Re:TTable.Filter expression with Memo fields?

Mike Shkolnik schrieb:
Quote
Use single quotes in the Filter

In the Prop-Editor they were single.
I used double quotes here because of the string presentation.
felix