Boolean filter
Posted: 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:
Another exception is throwed when you add a filter with more 'and' operations into a where filter.
This works fine:
This results into a EExpressionException(TQueryConverter - Invalid node type {0}).
Result string:
Linq:
Thanks.
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}
This works fine:
Code: Select all
LWhere := '(Relatie.Snelcode.Contains(''%' + edtSnelcode.text + '%''))' +
' and (Relatie.ZoekNaam.Contains(''%' + edtZoeknaam.text + '%''))';
Code: Select all
LWhere := '(Relatie.Snelcode.Contains(''%' + edtSnelcode.text + '%''))' +
' and (Relatie.ZoekNaam.Contains(''%' + edtZoeknaam.text + '%''))'+
' and (Relatie.RelatieNaam.Contains(''%' + edtRelatienaam.text + '%''))';
Code: Select all
LWhere := '(Relatie.Snelcode.Contains(''%%'')) and (Relatie.ZoekNaam.Contains(''%%'')) and (Relatie.RelatieNaam.Contains(''%%''))'
Code: Select all
LQuery := From('Relatie').Where(LWhere).OrderBy('Relatie.Snelcode').Select();
LList := DataContext.GetEntities<TRelatie>(LQuery).ToList;