本帖最后由 shary 于 2013-4-28 11:24 编辑
我在表单中添加一个计算脚本控件:
var sql ="select domainid,id,formid, count(*) as item_total,item_单位类型,item_地市 as item_地区 from tlk_赋值测试一 group by item_单位类型,item_地市 union select domainid,id,formid, count(*) as item_total,item_单位类型,item_地区 as item_地区 from tlk_赋值测试一 group by item_单位类型,item_地区";
println("sql=="+sql+"---");
var datas =queryBySQLWithCache(sql);
println("datas====="+datas.size()+"////");
var doc =getCurrentDocument();
if(datas != null)
{
for(iter1 = datas.iterator(); iter1.hasNext();)
{
var subdoc = iter1.next();
var total = subdoc.getItemValueAsString("total");
println("total==="+total+"====");
var value =subdoc.getItemValueAsString("单位类型")+"_"+subdoc.getItemValueAsString("地区");
println("value====="+value+"||||||||||||||");
if(doc.findItem(value))
{
doc.findItem(value).setValue(total);
println("/////"+doc.findItem(value).getValue()+"\\\\\\\\");
}
}
println("当前文档的内容====="+doc+"///////////////////");
}
查询数据库给当前表单的字段赋值.
debug发现,我能查询到数据,并且赋值成功,但是页面不显示.
请问是i我的代码有问题,缺少什么,还是怎样? |