Page 1 of 1

Foundset find mode equivalent of NOT IN (...)

PostPosted: Tue May 01, 2018 9:02 am
by steve1376656734
Hi,

Using a foundset in find mode I can search for records which have a field with values that are in an array by using:

Code: Select all
foundset.find();
foundset.myField = ['value1', 'value2', 'value3', ...];
foundset.search();

What is the equivalent code for finding records whose value is NOT IN the array i.e. WHERE myTable.myField NOT IN ('value1', 'value2', 'value3', ...)?

I would normally do this sort of thing using Query Builder as it has much more control over finding records, but in this particular scenario one of the criteria that I am using in the search (not the array based one) is a calculation and I can't find a way to include calculations in a Query Builder select statement.

A solution to either scenario (find mode NOT IN or Query Builder using calculations) would be most appreciated.

Thanks
Steve

Re: Foundset find mode equivalent of NOT IN (...)

PostPosted: Fri May 11, 2018 11:08 am
by rgansevles
steve1376656734 wrote:one of the criteria that I am using in the search (not the array based one) is a calculation and I can't find a way to include calculations in a Query Builder select statement


Steve,

Search using find mode ends up doing a query in the database as well, for this reason non-stored calculations are not supported in find mode.
If the calculation is stored (so it is also a db column) you can use it icw the QueryBuilder.

Rob