I am trying to create a report in NetSuite. I want to filter out certain data in regards to one parameter, then I want to filter in data by using another parameter. Is there an AND/OR filter in NetSuite?
On the Criteria subtab of an advanced or saved search, check the Use Expressions box. To indicate that an expression sets criteria for records or transactions that you do not want to include in your results, check the box in the Not column. In the Parens column, select an opening parenthesis to begin an expression.
To edit a report in the Report Builder, you can: click Customize on the Reports page, click the Customize button on the report page itself, or for ad hoc reports, click the More Customization button on the new report definition page.
If you are doing it using Netsuite Report/search interface, click on Use Advanced Search and then check Use Expressions. You would see the And/Or column in the Criteria Tab.
If you are doing it using Suit Script use Search Filter Expressions
//Define search filter expression
var filterExpression = [
[ 'trandate', 'onOrAfter', 'daysAgo90' ],
'or',
[ 'projectedamount', 'between', 1000, 100000 ],
'or',
'not', [ 'customer.salesrep', 'anyOf ', -5]
];
I encountered the situation in which i need to use AND/OR filter in Netsuite. I achieved this by :
You can directly give static filter value by
filters: [
['internalid', 'anyof', parseInt(customer_internal_id)],
'and',
['transaction.internalidnumber', 'equalto', parseInt(salesorder_internal_id)],
'and',
['transaction.mainline', 'is', 'true']
]
If you want to dynamically add filter , you store/push your filter to a array and set this array as filter. You can achieve this by
var individualFilter = [], combineIndividualFilter = [], defaultFilters = [];
for (var i = 0; i < numLines; i++) {
individualFilter[0] = ['formulatext: {category}','startswith',"Related Items for "+ itemName[i].split(" :")[0]];
combineIndividualFilter.push(individualFilter[0]);
if ((i + 1) != numLines) {
combineIndividualFilter.push('OR');
}
}
defaultFilters.push(combineIndividualFilter);
defaultFilters.push('AND');
defaultFilters.push(['website', 'anyof', 3 ]);
defaultFilters.push('AND');
defaultFilters.push(['formulatext: {storedisplayimage}','isnotempty', null ]);
and finally by setting
filters : defaultFilters
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With