• Netsuite SuiteScript > Search Advance feature,搜索中使用 'OR' operation


    Sample in online help

    //Define search filter expression
    var filterExpression =	[ [ 'trandate', 'onOrAfter', 'daysAgo90' ],
    			   'or',
    		      [ 'projectedamount', 'between', 1000, 100000 ],
    			   'or',
    			  'not', ['customer.salesrep', 'anyOf', -5 ]  ] ;
     
    //Define search columns
    var columns = new Array();
    columns[0] = new nlobjSearchColumn('salesrep');
    columns[1] = new nlobjSearchColumn('expectedclosedate');
    columns[2] = new nlobjSearchColumn('entity');
     
    //Execute the search. You must specify the internal ID of the record type.
    var searchresults = nlapiSearchRecord('opportunity', null, filterExpression, columns);
     

    由于nlobjSearchFilter默认发出的都是‘AND’的指令,所以这个api,无法完成or的操作。

    By default, search filter list (nlobjSearchFilter[]) makes use only of an implicit ‘AND' operator for filters. This is contrary to search filter expression that can explicitly use either ‘AND' or ‘OR' operators.

    [ 'trandate', 'onOrAfter', 'daysAgo90' ],
    'or',
    [ 'projectedamount', 'between', 1000, 100000 ],

    这种操作参数,直接不适用nlobjSearchFilter,而且没有reference其他record的功能;
    整个API还是低于UI的USE EXPRESSIONS功能的。
    所以另外方案
    1。在UI上定义这类OR或者或者包含Parens的Search,然后suitescript去直接调用结果。
    2。使用多个Search,消耗更多的unit来实现复杂的单个Search。

     
  • 相关阅读:
    flex自适应小例子
    hasOwnProperty 递归 简单回调 链式调用
    H5音频和视频
    html特殊字符
    css巧妙实现分隔线
    SQL Server中数据的存储
    SQL高级查询
    SQL SERVER查询到的数据转为Json格式
    SQL动态生成列
    SQL合并查询数据,以逗号分隔
  • 原文地址:https://www.cnblogs.com/backuper/p/4045086.html
Copyright © 2020-2023  润新知