Page 1 of 1

ZEOS 7.2.4 Filter error

Posted: 11.09.2019, 15:48
by dev.bt
I am using that to filter :

Code: Select all

 procedure TNGrid.EditChange(Sender: TObject);
 Var
   En_tete : string; //header name
 begin
  if (Col <> Null) and (Col >= CFix) then
   En_tete := MyDataset.Fields[Col-1].DisplayName;
   if NOT (TEdit(Sender).Text = '') then
   begin
    MyDataset.Filtered:= false;
    MyDataset.Filter:= En_tete+' like ''*'+TEdit(Sender).Text+'*''';
    MyDataset.Filtered:= true;
   end
   else
   begin
    MyDataset.Filtered:= false;
    MyDataset.Filter:='';
   end;
   Filter2();
 end;
I can't filter the last character .
And when the cell contains one char then it does not filter at all. :?:
thanks for your help.

Re: ZEOS 7.2.4 Filter error

Posted: 12.09.2019, 07:14
by aehimself
Hello,

Filtering works just fine from 0 characters up. What I can see is that you are NOT ignoring the case, which means the value "Test" will not show up if you filter "like '%S%'".

Try this:

Code: Select all

MyDataset.Filter := En_tete + ' like LOWER(''*' + String(TEdit(Sender).Text).ToLower + '*'')';
There is a really nice document what describes what "functions" you can use in a query filter:
https://sourceforge.net/projects/zeosli ... mentation/
and download "ZExpression.pdf"

Re: ZEOS 7.2.4 Filter error

Posted: 12.09.2019, 10:50
by dev.bt
i will try it.

Re: ZEOS 7.2.4 Filter error

Posted: 12.09.2019, 11:54
by dev.bt
the result of ShowMessage(MyDataset.Filter); is : NOM like LOWER('*a*') // NOM is the header of the Column.

All records with an 'a' will show unless it ends with an 'a' or the cell squals an 'a' then it doesn't filter.
it's like as if it doesn't read the last char at all (IsMatch or the LIKE Operator).

Re: ZEOS 7.2.4 Filter error

Posted: 12.09.2019, 12:09
by marsupilami
Hello,

I think this might be the same problem as in our Ticket #369.
Best regards,

Jan

Re: ZEOS 7.2.4 Filter error

Posted: 12.09.2019, 13:13
by dev.bt
Absolutely true.i have to solve the problem as quickly as possible.
Thanks anyway.