2016-08-01 29 views
0

我想在'N/Search'模块中使用圆括号添加过滤条件。我在Netsuite保存的搜索选项(IN用户界面)中添加了带有条件的括号“()”,但我没有在“SuiteScript 2.0版本”过滤器数组中添加括号内的条件。如何在'N/search'模块过滤器中添加括号中的过滤条件

我想要的下面图像上这样的括号中加入的条件:

[1]

[[如何与过滤器阵列(SuiteScript)]在括号过滤条件[1]!]

我的代码:

filters = [ 
    ['custrecord_employee_name', 'is', employeeId], 'AND' 
    ['custrecord_item_category', 'is', ItemCategoryId], 'AND', 
    ['custrecord_commissions_owner', 'is', BookOwnerID], 'AND', 
    ['custrecord_form', 'is', formId], 'AND', 
    (
    ['custrecord_from_date', 'onorbefore', createdDate], 'OR' 
    ['custrecord_from_date', 'onorafter', createdDate] 
), 'AND', 
    (
    ['custrecord_end_date', 'onorbefore', endDate], 'OR', 
    ['custrecord_end_date', 'onorafter', endDate] 
) 
]; 

回答

3

当使用过滤器表达式,你组条件使用数组的新层结合在一起。在你的代码中,你只需用方括号替换括号即可。此外,请确保您已将filtersvar一起声明在您的函数中,以便它不是全局的。

var filters = [ /* use var to avoid global */ 
    ['custrecord_employee_name', 'is', employeeId], 'AND' 
    ['custrecord_item_category', 'is', ItemCategoryId], 'AND', 
    ['custrecord_commissions_owner', 'is', BookOwnerID], 'AND', 
    ['custrecord_form', 'is', formId], 'AND', 
    [ /* array here instead of parens */ 
    ['custrecord_from_date', 'onorbefore', createdDate], 'OR' 
    ['custrecord_from_date', 'onorafter', createdDate] 
    ], 'AND', 
    [ /* and again here */ 
    ['custrecord_end_date', 'onorbefore', endDate], 'OR', 
    ['custrecord_end_date', 'onorafter', endDate] 
    ] 
]; 

所有这一切,我不太清楚你的日期过滤器正在完成。对于createdDateendDate,看起来它们可以是它们在记录上对应的字段中的任何一个,其基本上是任何日期。

什么是你实际上试图用这些过滤器检索?

+0

嗨Erictgrubaugh,我编辑了我的问题与要求,我的过滤器试图基于Requiement工作。 –