是Kettle循环转换(t1.ktr)中的结果集,放到转换2(var.ktr)中,输出到本地txt文件中
1.1 jobj1.kjb
JavaScriptvar prevRow=previous_result.getRows();//获取上一个传递的结果
if (prevRow == null &&(prevRow.size()=0))
{
false;
}else{
parent_job.setVariable("tables", prevRow);//ArrayList存储表名变量,以数组形式保存入table1,table2
parent_job.setVariable("size", prevRow.size());//存储执行表的总数量
parent_job.setVariable("i", 0);//循环控制变量
parent_job.setVariable("id", prevRow.get(0).getString("id", ""));
parent_job.setVariable("name", prevRow.get(0).getString("name", ""));
true;
}
检验字段的值
JavaScript2
var prevRow=previous_result.getRows();
var size = new Number(parent_job.getVariable("size"));
var i = new Number(parent_job.getVariable("i"))+1;
if(i<size){
parent_job.setVariable("id", prevRow.get(i).getString("id", ""));
parent_job.setVariable("name", prevRow.get(i).getString("name", ""));
}
parent_job.setVariable("i",i);
true;
1.2 转换
t1.ktr
配置参考:
Kettle循环获取结果集
var.ktr
获取变量 文本文件输出