将日期过滤器添加到脚本搜索 (SuiteScript 1.0) 的正确方法是什么?
What is the correct way to add a Date Filter to a scripted search (SuiteScript 1.0)?
我在 SS1.0 中有一个内置搜索的脚本,其中包含一个日期范围过滤器,但是尽管某些交易 {trandate}
超出了给定范围,但它们仍会继续包含在内。
我试过添加过滤器对象和使用过滤器表达式。
目前看起来像:
filters.push(new nlobjSearchFilter('trandate',null,'onorafter',startdate));
filters.push(new nlobjSearchFilter('trandate',null,'onorbefore',statementdate));
这应该会导致检索开始日期和报表日期之间的交易包括。
然而,仍然会得到超出范围的结果(即,在开始日期之前)
试试下面的代码
filters.push(new nlobjSearchFilter('trandate',null,'within',startdate,statementdate));
这两个都应该有效。如果您有真实的日期,请务必转换它们:
filters.push(new nlobjSearchFilter('trandate',null,'onorafter',nlapiDateToString(startdate)));
filters.push(new nlobjSearchFilter('trandate',null,'onorbefore',nlapiDateToString(statementdate)));
我在 SS1.0 中有一个内置搜索的脚本,其中包含一个日期范围过滤器,但是尽管某些交易 {trandate}
超出了给定范围,但它们仍会继续包含在内。
我试过添加过滤器对象和使用过滤器表达式。
目前看起来像:
filters.push(new nlobjSearchFilter('trandate',null,'onorafter',startdate));
filters.push(new nlobjSearchFilter('trandate',null,'onorbefore',statementdate));
这应该会导致检索开始日期和报表日期之间的交易包括。
然而,仍然会得到超出范围的结果(即,在开始日期之前)
试试下面的代码
filters.push(new nlobjSearchFilter('trandate',null,'within',startdate,statementdate));
这两个都应该有效。如果您有真实的日期,请务必转换它们:
filters.push(new nlobjSearchFilter('trandate',null,'onorafter',nlapiDateToString(startdate)));
filters.push(new nlobjSearchFilter('trandate',null,'onorbefore',nlapiDateToString(statementdate)));