My code is like that:
var filters = new Array();
filters[0] = new nlobjSearchFilter("isperson", "customer", "is", "F")
filters[1] = new nlobjSearchFilter([["minimumquantity", "equalto", "0"], "OR", ["minimumquantity", "isempty", ""]]);
if (customerId) filters.push(new nlobjSearchFilter("customer", null, "anyof", customerId));
if (currency) filters.push(new nlobjSearchFilter("currency", null, "anyof", currency));
My question is how do I make filters[1] works with the 'OR' operator?
You were on the right track with the 'or' condition.
I can't tell which record you're trying to query, but the easiest way to control multiple and/or conditions when building a search is to use search "filter expressions" rather than manually building with
nlobjSearchFilter()
.If you want to continue using
nlobjSearchFilter()
, look up how to use the.setLeftParens()
/.setRightParens()
and.setOr()
functions (example). They're not documented in the NetSuite help).