如何在'N/search'模块过滤器中添加带括号的过滤条件

How add filter conditions with the parenthesis in 'N/search' module filters

我想在'N/Search'模块中使用括号添加过滤条件。

我在 Netsuite 保存的搜索选项(在用户界面)中添加了带有条件的括号“()”,但我没有在 "SuiteScript 2.0 version" 过滤器数组中的括号内添加条件.

我想在下图中的括号内添加条件:

[![如何使用过滤器数组上的括号过滤条件(SuiteScript)][1]][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]
  )
];

使用过滤器表达式时,您将条件与新的数组层组合在一起。在您的代码中,您只需将括号替换为方括号。另外,请确保您已在函数中的某处声明了 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,看起来它们可以是onbeforeafter中的任何一个它们在记录上的相应字段,这基本上是任何日期。

您实际尝试使用这些过滤器检索的是什么?