Page 1 of 1

Filter expression using 'IN'

Posted: Mon 18 May 2009 19:57
by yozey
Should a filter expression on TPgQuery using 'IN' cause an exception?

I have the following code

Code: Select all

PgQuery.Filter := 'id IN(8,10,22)';
PgQuery.Filtered := True; // Illegal filter expression
It raises an Illegal filter expression. Why?

Posted: Tue 19 May 2009 06:58
by Plash
Filter does not support IN expression.

Posted: Tue 19 May 2009 18:31
by yozey
So is it then recommended to build and OR list of all values for the field I wish to filter on?

Posted: Wed 20 May 2009 07:10
by Plash
Yes, you can use OR operator to build an expression.

Posted: Wed 20 May 2009 11:20
by yozey
Yes, you can use OR operator to build an expression.
Yes this is what I ended up implementing.

Thanks