1.JavaScript
var 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",new Number(0));//迴圈控制變數 parent_job.setVariable("k",0); parent_job.setVariable("id", prevRow.get(0).getString("hosp","hosp"));//根據欄位名擷取值 parent_job.setVariable("hospname", prevRow.get(0).getString("hospname","hospname")); true;}
2.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("hosp","hosp")); parent_job.setVariable("hospname",prevRow.get(i).getString("hospname","hospname"));}parent_job.setVariable("i",i); true;
3.迴圈停止條件,
4.資料庫結果集查詢