zoukankan      html  css  js  c++  java
  • 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。

     
  • 相关阅读:
    Educational Codeforces Round 6
    Codeforces Round #373 (Div. 2)
    尺取法
    Codeforces Round #542 [Alex Lopashev Thanks-Round] (Div. 2)
    逆元(数论倒数)
    最大公约数gcd,最小公倍数lcm,扩展欧几里得
    hdu 6395 Sequence (分段矩阵快速幂)
    快速幂
    hdu 6432 Cyclic
    hdu 6397 charactor encoding
  • 原文地址:https://www.cnblogs.com/backuper/p/4045086.html
Copyright © 2011-2022 走看看