Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NetSuite And/Or Filter

Tags:

netsuite

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?

like image 420
user3286031 Avatar asked Feb 08 '14 01:02

user3286031


People also ask

How do I use expressions in saved search 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.

How do I customize a report in NetSuite?

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.


2 Answers

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] 
];
like image 156
Saqib Avatar answered Sep 21 '22 16:09

Saqib


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
like image 34
Manu AVS Avatar answered Sep 19 '22 16:09

Manu AVS