Mapreduce SuiteScript 2.0映射缩减脚本完整示例
我在Netsuite中遇到超出SSS使用限制的错误。 我计划将搜索更改为使用Map Reduce脚本,但是,我没有找到调用Map Reduce脚本的完整示例,例如如何将参数传递给Map Reduce脚本并从中获取结果集。你能告诉我怎么做吗?提前谢谢 下面显示如何定义要调用Map Reduce脚本的任务Mapreduce SuiteScript 2.0映射缩减脚本完整示例,mapreduce,scriptlet,Mapreduce,Scriptlet,我在Netsuite中遇到超出SSS使用限制的错误。 我计划将搜索更改为使用Map Reduce脚本,但是,我没有找到调用Map Reduce脚本的完整示例,例如如何将参数传递给Map Reduce脚本并从中获取结果集。你能告诉我怎么做吗?提前谢谢 下面显示如何定义要调用Map Reduce脚本的任务 )) Map/Reduce脚本类型为您提供4个入口点函数来加载/处理数据: getInputData(inputContext) 地图(mapContext) reduce(reduceCon
)) Map/Reduce脚本类型为您提供4个入口点函数来加载/处理数据:
- getInputData(inputContext)
- 地图(mapContext)
- reduce(reduceContext)
- 总结(总结上下文)
例如:
函数摘要(上下文){ context.output.iterator().each(函数(键、值){ //你的逻辑在这里 返回true; }); }
我得到了如何将参数传递给getInputData的答案。但我不知道如何从地图或摘要中得到结果?如果你以前试过,请告诉我。提前谢谢
define(['N/record', 'N/log', 'N/Task'],
function (record, log, task) {
function setFieldInRecord (scriptContext) {
log.debug({
'title': 'TESTING',
'details': 'WE ARE IN THE FUNCTION!'
});
if (scriptContext.type === scriptContext.UserEventType.EDIT) {
var scriptTask = task.create({
taskType: task.TaskType.MAP_REDUCE
});
scriptTask.scriptId = 'customscript_id';
scriptTask.deploymentId = 'customdeploy_id';
var scriptTaskId = scriptTask.submit();
//How to pass parameter to getInputData?
//How to get the result?
}
}
return {
beforeSubmit: setFieldInRecord
};
}