What is needed is “All records where country <> 14 AND country <> 32”
I tried on my own table
foundset.bp_country_id = ‘!=DEU||!=BEL’;
but that eliminated only DEU, not BEL.
And when we do a simple
country = “!=14”
country = “!=32”
then the second condition is overwriting the first.
In case nobody comes up with a find()-solution, this seems to be one of the cases where good old SQL should be used.
The code pattern for that:
var
/***@type {{sql:String, args:Array, server:String, maxRows:Number, table:String}}*/
oSQL = { },
/***@type{JSFoundSet} */
fsData;
oSQL.sql = "SELECT record_id FROM tablename WHERE country <> ? AND country <> ? ";
oSQL.args = [14,32];
oSQL.table = "tablename";
fsData = scopes.utils.sqlFoundset(oSQL);
forms['frm_formname_tbl'].foundset.loadRecords(fsData);
Well, negation could be done by that way when all other values are known, just by listing them.
But that depends too much on a complete list of those values and is therefore not really ironclad.
It looks like that using the Servoy way you can’t do it with 1 single search. You need to do it with 2 like so:
if(foundset.find()){
foundset.country = '!14';
foundset.search(); // search while clearing any previous results
// Now search within the result set
if(foundset.find()){
foundset.country = '!32';
foundset.search(false, true); // foundset.search(clearLastResults,reduceSearch)
}
}
But true, it’s easier (and totally cross platform so no worries about portability) to use SQL like so:
foundset.loadRecords("SELECT pkColumn FROM tableName WHERE country <> ? AND country <> ?",[14,32]);