Simple filter expression is also an array. It contains one or more filter terms, combined with operators - 'AND', 'OR', 'NOT'. (Operators are case insensitive):
[
['mainline', 'is', 'T'],
'and', ['type','anyof',['CustInvc','CustCred']],
'and', 'not', ['amount', 'equalto', '0.00'],
'or', ['customer.companyname', 'contains', 'ltd']
]
More complex filter expressions, could contain filter terms AND nested filter expressions, combined with operators. No more than 3 levels of nested expressions are allowed:
[
['mainline', 'is', 'T'],
'and', ['type','anyof',['CustInvc','CustCred']],
'and', [ ['customer.companyname', 'contains', 'ltd'],
'or', ['customer.companyname', 'contains', 'inc']
],
'and', [ ['subsidiary', 'is', 'HQ'],
'or', ['subsidiary', 'anyof', '@HIERARCHY@']
],
'and', ['trandate', 'notbefore', 'yesterday']
]
And finally, let's put all this altogether in a SS2.0 sample:
var s = search.create({
type : 'transaction',
columns : [
'trandate',
'tranid',
'currency',
'customer.companyname',
'customer.country',
'amount'
],
filters : [
['mainline', 'is', 'T'],
'and', ['type','anyof',['VendBill','VendCred']],
'and', [ ['customer.companyname', 'contains', 'ltd'],
'or', ['customer.companyname', 'contains', 'inc']
],
'and', [ ['subsidiary', 'is', 'HQ'],
'or', ['subsidiary', 'anyof', '@HIERARCHY@']
],
'and', ['trandate', 'notbefore', 'yesterday']
]
});