Boolean filter

Boolean filter

Postby 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.
AudioPat
 
Posts: 10
Joined: Fri 19 Jun 2015 15:47

Re: Boolean filter

Postby 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.
AlexP
Devart Team
 
Posts: 5525
Joined: Tue 10 Aug 2010 11:35


Return to EntityDAC