1
我试图从SuiteScript 2.0中的分页搜索中获取最后200个结果。当我运行简单代码时出现错误从页面搜索中提取最后n个结果
“name”:“INVALID_PAGE_RANGE”,“message”:“无效的页面范围:fetch。”
我究竟做错了什么?
下面的代码是在NS调试器(我已删除了简洁一些代码)运行:
function(ui, email, runtime, search, file, config, format, record, log) {
var mySearch = search.load({
id: 'customsearch_mht_lrf_export_to_lab'
});
// 200 results per page (am I correct here?)
var results = mySearch.runPaged({pageSize:200});
var count = results.count; // = 264
// Obtain the last 200 results. From the documentation;
// index is 'The index of the page range that bounds the desired data.'
// Error occurs on the next line
var data = results.fetch({index: results.count});
var x = 0;
});