tdamemdataset.Filter on fields = ''

hi it seems that i can’t filter a TdaMemDataset on empty string fields…
so something like:
var s:=‘’;
tda.filter = ‘(fieldthatcontainssomething=’+quotedstr(‘thisisit’)+‘) AND( fieldthatisemptystring=’+quotedstr(s)+‘)’;

expected behavior or?

Hi,

this works for me:

  • double quotes are used for constants
tda.filter = '([fieldthatcontainssomething]="thisisit") and ([fieldthatisemptystring]=""])';
  • single quotes are used for constants
tda.filter = '([fieldthatcontainssomething]=''thisisit'') and ([fieldthatisemptystring]=''''])';

so single or double quotes should work?
so QuotedStr() should also work right?

Hi,

yes

yes.

this code works for me too:

  DAMemDataTable1.Filter := 'item2 = ' + QuotedStr('');

Yoiu can check TDAMemDataTable filters (Delphi) article