Boolean filter

Discussion of open issues, suggestions and bugs regarding EntityDAC
Post Reply
AudioPat
Posts: 10
Joined: Fri 19 Jun 2015 15:47

Boolean filter

Post by AudioPat » Sat 26 Dec 2015 09:31

Hi,

How to filter a boolean field in linq in the where statement?
i've try the following examples:

Code: Select all

  LWhere := '(Container.Active = true)'; // Invalid expression (true)
  LWhere := '(Container.Active = '1');  // Invalid node type {46}
Another exception is throwed when you add a filter with more 'and' operations into a where filter.

This works fine:

Code: Select all

  LWhere := '(Relatie.Snelcode.Contains(''%' + edtSnelcode.text + '%''))' +
            ' and (Relatie.ZoekNaam.Contains(''%' + edtZoeknaam.text + '%''))';

This results into a EExpressionException(TQueryConverter - Invalid node type {0}).

Code: Select all

  LWhere := '(Relatie.Snelcode.Contains(''%' + edtSnelcode.text + '%''))' +
            ' and (Relatie.ZoekNaam.Contains(''%' + edtZoeknaam.text + '%''))'+
            ' and (Relatie.RelatieNaam.Contains(''%' + edtRelatienaam.text + '%''))';

Result string:

Code: Select all

  LWhere := '(Relatie.Snelcode.Contains(''%%'')) and (Relatie.ZoekNaam.Contains(''%%'')) and (Relatie.RelatieNaam.Contains(''%%''))'
Linq:

Code: Select all

  LQuery := From('Relatie').Where(LWhere).OrderBy('Relatie.Snelcode').Select();
  LList := DataContext.GetEntities<TRelatie>(LQuery).ToList;
Thanks.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Boolean filter

Post by AlexP » Mon 28 Dec 2015 07:11

Hello,

Thank you for the information. We have reproduced the problem and will investigate the reasons of such behavior.

Post Reply