方法1:
var i=1;
O_PARAMETER.FObject.each(
function(v) {
var empId = v.get("FEmployee");
LB_Logger("debug", empId);
LB_sqlExecute("insert into T_ZKX_TestUser (ID,FEmployee) values (?,?)",[i,empId]);
i++;
}
);
<%@ livebos language='javascript' %>
var fun = ABS_LOADBEAN("com.plug.FunctionHelper");
O_PARAMETER.FObject.each(
function(v) {
var vid = fun.utilHelper.getNextID("T_HR_TrainFile");
var empId = v.get("FEmployee");
var orgid;
var funit;
var rs = LB_sqlResultSet("select a.orgid orgid,b.funit funit from tUser a, lborganization b where b.id = a.orgid and a.FEmp = ?",[empId]);
while(rs.next()) {
orgid = rs.getString("orgid");
funit = rs.getString("funit");
}
LB_Logger("debug", "------------------------------------------empId="+empId);
LB_sqlExecute("insert into T_HR_TrainFile (ID,FEmployee,FDept,Funit,FTrainProject) values (?,?)",[vid,empId,orgid,funit,V_1.ID]);
}
);
方法2:
//表格字段的名称:FObject
var ho = O_PARAMETER.getColumn("FObject");
var temp = ho.getRecord();
temp.beforeFirst();
var i = 1;
while(temp.next()) {
var empId = temp.getInt("FEmployee");
LB_sqlExecute("insert into T_ZKX_TestUser(ID,FEmployee) values (?,?)",[i,empId]);
i++;
}