永洪社区

标题: 报错解决 [打印本页]

作者: yhdata_Nj6FjFqk    时间: 2021-11-25 15:16
标题: 报错解决
急!!!这个报错怎么解决啊

作者: _贝贝    时间: 2021-11-25 15:16
看一下位置是自由表4格间计算的脚本 第十行
作者: 美滋滋    时间: 2021-11-25 15:19
看看你自由式表格中的脚本,数值下标超界了。看看循环
作者: yhdata_Nj6FjFqk    时间: 2021-11-25 15:22
歪打正着 发表于 2021-11-25 15:19
看看你自由式表格中的脚本,数值下标超界了。看看循环

脚本没问题,这个报错是在快速往下拉报表时偶尔会存在,挺愁人的... 暂时我没想到有什么好的方法解决
作者: _贝贝    时间: 2021-11-25 15:27
第十行脚本怎么写的呢
作者: 美滋滋    时间: 2021-11-25 15:34
还是把脚本发出来看看吧
作者: yhdata_Nj6FjFqk    时间: 2021-11-25 15:47
永洪tech-zxx 发表于 2021-11-25 15:27
第十行脚本怎么写的呢

//n.setSelectedObjects([n.getObjects()[0][0]],STRING)
//范围过滤1.setSelectedObjects([formatDate(dateAdd(new Date(),"day",-1),"MM")],STRING)

范围过滤1.setSelectedObjects([formatDate(dateAdd(new Date(),"day",-1),"MM")],STRING)



var loc= new Locator(["r-0"], ROW, DETAIL);
自由式表格2.setRowHeight(loc,0);

var loc1= new Locator(["r-1"], ROW, DETAIL);
自由式表格2.setRowHeight(loc1,0);

var loc2= new Locator(["r-2"], ROW, DETAIL);
自由式表格2.setRowHeight(loc2,0);

var loc3= new Locator(["r-3"], ROW, DETAIL);
自由式表格2.setRowHeight(loc3,0);

var loc4= new Locator(["r-4"], ROW, DETAIL);
自由式表格2.setRowHeight(loc4,0);

var loc= new Locator(["r-0"], ROW, DETAIL);
自由式表格1.setRowHeight(loc,0);

var loc1= new Locator(["r-1"], ROW, DETAIL);
自由式表格1.setRowHeight(loc1,0);

var loc2= new Locator(["r-2"], ROW, DETAIL);
自由式表格1.setRowHeight(loc2,0);

var loc3= new Locator(["r-3"], ROW, DETAIL);
自由式表格1.setRowHeight(loc3,0);

var loc4= new Locator(["r-4"], ROW, DETAIL);
自由式表格1.setRowHeight(loc4,0);

var loc= new Locator(["r-0"], ROW, DETAIL);
自由式表格3.setRowHeight(loc,0);

var loc1= new Locator(["r-1"], ROW, DETAIL);
自由式表格3.setRowHeight(loc1,0);

var loc2= new Locator(["r-2"], ROW, DETAIL);
自由式表格3.setRowHeight(loc2,0);

var loc3= new Locator(["r-3"], ROW, DETAIL);
自由式表格3.setRowHeight(loc3,0);

var loc4= new Locator(["r-4"], ROW, DETAIL);
自由式表格3.setRowHeight(loc4,0);

var loc= new Locator(["r-0"], ROW, DETAIL);
自由式表格4.setRowHeight(loc,0);

var loc1= new Locator(["r-1"], ROW, DETAIL);
自由式表格4.setRowHeight(loc1,0);

var loc2= new Locator(["r-2"], ROW, DETAIL);
自由式表格4.setRowHeight(loc2,0);

var loc3= new Locator(["r-3"], ROW, DETAIL);
自由式表格4.setRowHeight(loc3,0);

var loc4= new Locator(["r-4"], ROW, DETAIL);
自由式表格4.setRowHeight(loc4,0);

var loc= new Locator(["r-0"], ROW, DETAIL);
自由式表格5.setRowHeight(loc,0);

var loc1= new Locator(["r-1"], ROW, DETAIL);
自由式表格5.setRowHeight(loc1,0);

var loc2= new Locator(["r-2"], ROW, DETAIL);
自由式表格5.setRowHeight(loc2,0);

var loc3= new Locator(["r-3"], ROW, DETAIL);
自由式表格5.setRowHeight(loc3,0);

var loc4= new Locator(["r-4"], ROW, DETAIL);
自由式表格5.setRowHeight(loc4,0);
var loc= new Locator(["r-0"], ROW, DETAIL);
自由式表格6.setRowHeight(loc,0);

var loc1= new Locator(["r-1"], ROW, DETAIL);
自由式表格6.setRowHeight(loc1,0);

var loc2= new Locator(["r-2"], ROW, DETAIL);
自由式表格6.setRowHeight(loc2,0);

var loc3= new Locator(["r-3"], ROW, DETAIL);
自由式表格6.setRowHeight(loc3,0);

var loc4= new Locator(["r-4"], ROW, DETAIL);
自由式表格6.setRowHeight(loc4,0);


var a = getData("范围过滤1").size();  //获取范围过滤的所有数据个数
var sum = 0;
var c = new Array();
for(var i=0;i<a;i++){
    var b =范围过滤1.getSelectedObjects();        //获取范围过滤所选的数据
    if(b!=null){        //判断选择项是否为空
        sum=sum+1;
        c.push(b);        
    }
}
param['y']=c[sum-1]


作者: yhdata_Nj6FjFqk    时间: 2021-11-25 15:48
歪打正着 发表于 2021-11-25 15:34
还是把脚本发出来看看吧

//n.setSelectedObjects([n.getObjects()[0][0]],STRING)
//范围过滤1.setSelectedObjects([formatDate(dateAdd(new Date(),"day",-1),"MM")],STRING)

范围过滤1.setSelectedObjects([formatDate(dateAdd(new Date(),"day",-1),"MM")],STRING)



var loc= new Locator(["r-0"], ROW, DETAIL);
自由式表格2.setRowHeight(loc,0);

var loc1= new Locator(["r-1"], ROW, DETAIL);
自由式表格2.setRowHeight(loc1,0);

var loc2= new Locator(["r-2"], ROW, DETAIL);
自由式表格2.setRowHeight(loc2,0);

var loc3= new Locator(["r-3"], ROW, DETAIL);
自由式表格2.setRowHeight(loc3,0);

var loc4= new Locator(["r-4"], ROW, DETAIL);
自由式表格2.setRowHeight(loc4,0);

var loc= new Locator(["r-0"], ROW, DETAIL);
自由式表格1.setRowHeight(loc,0);

var loc1= new Locator(["r-1"], ROW, DETAIL);
自由式表格1.setRowHeight(loc1,0);

var loc2= new Locator(["r-2"], ROW, DETAIL);
自由式表格1.setRowHeight(loc2,0);

var loc3= new Locator(["r-3"], ROW, DETAIL);
自由式表格1.setRowHeight(loc3,0);

var loc4= new Locator(["r-4"], ROW, DETAIL);
自由式表格1.setRowHeight(loc4,0);

var loc= new Locator(["r-0"], ROW, DETAIL);
自由式表格3.setRowHeight(loc,0);

var loc1= new Locator(["r-1"], ROW, DETAIL);
自由式表格3.setRowHeight(loc1,0);

var loc2= new Locator(["r-2"], ROW, DETAIL);
自由式表格3.setRowHeight(loc2,0);

var loc3= new Locator(["r-3"], ROW, DETAIL);
自由式表格3.setRowHeight(loc3,0);

var loc4= new Locator(["r-4"], ROW, DETAIL);
自由式表格3.setRowHeight(loc4,0);

var loc= new Locator(["r-0"], ROW, DETAIL);
自由式表格4.setRowHeight(loc,0);

var loc1= new Locator(["r-1"], ROW, DETAIL);
自由式表格4.setRowHeight(loc1,0);

var loc2= new Locator(["r-2"], ROW, DETAIL);
自由式表格4.setRowHeight(loc2,0);

var loc3= new Locator(["r-3"], ROW, DETAIL);
自由式表格4.setRowHeight(loc3,0);

var loc4= new Locator(["r-4"], ROW, DETAIL);
自由式表格4.setRowHeight(loc4,0);

var loc= new Locator(["r-0"], ROW, DETAIL);
自由式表格5.setRowHeight(loc,0);

var loc1= new Locator(["r-1"], ROW, DETAIL);
自由式表格5.setRowHeight(loc1,0);

var loc2= new Locator(["r-2"], ROW, DETAIL);
自由式表格5.setRowHeight(loc2,0);

var loc3= new Locator(["r-3"], ROW, DETAIL);
自由式表格5.setRowHeight(loc3,0);

var loc4= new Locator(["r-4"], ROW, DETAIL);
自由式表格5.setRowHeight(loc4,0);
var loc= new Locator(["r-0"], ROW, DETAIL);
自由式表格6.setRowHeight(loc,0);

var loc1= new Locator(["r-1"], ROW, DETAIL);
自由式表格6.setRowHeight(loc1,0);

var loc2= new Locator(["r-2"], ROW, DETAIL);
自由式表格6.setRowHeight(loc2,0);

var loc3= new Locator(["r-3"], ROW, DETAIL);
自由式表格6.setRowHeight(loc3,0);

var loc4= new Locator(["r-4"], ROW, DETAIL);
自由式表格6.setRowHeight(loc4,0);


var a = getData("范围过滤1").size();  //获取范围过滤的所有数据个数
var sum = 0;
var c = new Array();
for(var i=0;i<a;i++){
    var b =范围过滤1.getSelectedObjects();        //获取范围过滤所选的数据
    if(b!=null){        //判断选择项是否为空
        sum=sum+1;
        c.push(b);        
    }
}
param['y']=c[sum-1]


作者: yhdata_Nj6FjFqk    时间: 2021-11-25 16:33
永洪tech-zxx 发表于 2021-11-25 16:15
看一下位置是自由表4格间计算的脚本 第十行

var a_19=0
var a_18=0
var leiji
if(cell(ridx-4,cidx)==null
|| cell(ridx-3,cidx)==null || cell(ridx-4,0)=="年" || cell(ridx-3,0)=="年")
{
leiji=0
}else{
for(i=0;i<cidx;i++){
a_19 = a_19+cell(ridx-3,cidx-i);
a_18 = a_18+cell(ridx-4,cidx-i);}
if(a_18!=0){
leiji=(a_19-a_18)/a_18;}
}
作者: _贝贝    时间: 2021-11-25 16:49
a_19 = a_19+cell(ridx-3,cidx-i);
a_18 = a_18+cell(ridx-4,cidx-i);}  

这个循环确定每次执行的时候数据一直都是有的吗 替换为实际值会报错吗
作者: yhdata_Nj6FjFqk    时间: 2021-11-25 17:10
永洪tech-zxx 发表于 2021-11-25 16:49
a_19 = a_19+cell(ridx-3,cidx-i);
a_18 = a_18+cell(ridx-4,cidx-i);}  

都是有的  但有时候报表往下拖的时候就会报错   是因为没有识别到字段么?




欢迎光临 永洪社区 (https://club.yonghongtech.com/) Powered by Discuz! X3.4