根据选择字段组合生成一个只展示需要字段的表格,ok看脚本!
//清空列表头
交叉表1.binding.clearColHeaders();
var arr_colhea=列表头.getSelectedObjects();
var colhea_bcol=NULL;
var dimcol_hea=NULL;
var colhea_name=NULL;
for(var i=0;i<arr_colhea.length;i++){
colhea_name=arr_colhea[i;
colhea_bcol=new BCol(toString(colhea_name),STRING,true);
dimcol_hea=new DimCol(colhea_bcol);
//添加勾选的列表头
交叉表1.binding.addColHeader(dimcol_hea);
}
//清空行表头
交叉表1.binding.clearRowHeaders();
var arr_rowhea=行表头.getSelectedObjects();
var rowhea_name=NULL;
var rowhea_bcol=NULL;
var rowhea_dim=NULL;
for(var j=0;j<arr_rowhea.length;j++){
rowhea_name=arr_rowhea[j;
rowhea_bcol=new BCol(rowhea_name,STRING,true);
rowhea_dim=new DimCol(rowhea_bcol);
//
交叉表1.binding.addRowHeader(j,rowhea_dim)
}
//清空汇总字段
交叉表1.binding.clearMeasures();
var arr_mea=统计指标.getSelectedObjects();
var mea_name=NULL;
var mea_bcol=NULL;
var meacol=NULL;
for(var l=0;l<arr_mea.length;l++){
mea_bcol=mea_name=arr_mea[l;
mea_bcol=new BCol(mea_name,INTEGER,false)
meacol=new MeasureCol(SUM,mea_bcol,NULL)
//
交叉表1.binding.addMeasure(meacol)
}
//分组合计
交叉表1.binding.showRTotal=true;//合并
交叉表1.binding.spanTopLeft=true;
|