Q:我要在摘要中,获取子表单的内容,然后拼接成一段通知信息,但是写好这后,在表单保存时报错。该脚本已经证实在其他的地方运行有效。
以下是脚本
var docId=getId();
var sql="select * from fm_CMP_SCFW_HMSQ_Msisdn where parent='"+docId+"'";
var subdocs=queryBySQL(sql);
var info="";//拼接的字符串
if (subdocs != null && subdocs.size() > 0) {
for(var it = subdocs .iterator();it.hasNext();){
var subdoc= it.next();//子表单记录
info+=subdoc.getItemValueAsString("msisdn")+" "+subdoc.findItem("reduce").getValue()+" "+subdoc.findItem("rule_money").getValue()+";";
}
}
A:
您好,您将您最先的代码改成一下代码就可以了。
var info = ""; //拼接的字符串
var docid = getCurrentDocument().getDomainid();//前面的函数是取得当前文档,得到企业域的id
var applicationid = $WEB.getParamsTable().getParameterAsString("application")//根据前面$WEB。getParamsTable()是获得ParamsTable,getParameterAsString("application")是取得参数applicationid
var process = getDocProcess(applicationid);//根据application得到一个处理类
var sql = "select * from tlk_notice where parent='" + getId() + "'";
var subdocs = process.queryBySQL(sql, docid);//根据id查询
var subdocs2 = subdocs.datas;
for (var it = subdocs2.iterator(); it.hasNext();) {//迭代循环
var subdoc = it.next(); //子表单记录
info = subdoc.getItemValueAsString("subject");
}
info;