Can I use the "IN" filter in the Advantage database table (TAdsTable)?

I want to apply a filter to the benefits table using several values ​​for the Integer field.

Equivalent SQL would be:

SELECT * FROM TableName WHERE FieldName IN (1, 2, 3)

Is it possible to do the same in AdsTable in that you need to repeat the field using "OR"?

I want something like:

Filter := 'FieldName IN (1, 2, 3)'

Instead:

Filter := 'FieldName = 1 OR FieldName = 2 OR FieldName = 3'
+3
source share
2 answers

You can use the function for this INLIST. This feature exists for compatibility with Visual FoxPro. It will look like this:

Filter := 'InList(FieldName, 1, 2, 3)';

However, I do not believe that it is currently optimized to use the index. Therefore, if the table is very large, it will be much more efficient to use the version of the filter FieldName = 1 OR FieldName = 2 ....

+2

All Articles