报表标题显示内容分条件显示控制

有时候报表展示内容及标题会出现错乱,但又不能在结果集中将干扰项去掉,用于排序的结果集字段‘’class‘’中有其他干扰项比如‘’差,但是我们只需要一等-五等,这时需要我们在标题中对显示名称进行限定

 修改前 

INSERT INTO SESSION.captions(caption, width, property, format, fixcol, align, datatype, ordertag,TYPE)
    VALUES ('品牌',70,'tradename','',0, 'center', 0,'001',0)
    union all
     select distinct trim(name)||'##排名',60,trim(class)||'rank','',0, 'center', 0,trim(class)||'_1',0 from session.results
     union all
     select distinct trim(name)||'##本期',60,trim(class)||'bq_qty','0.00',0, 'center', 0,trim(class)||'_2',0 from session.results
     union all
     select distinct trim(name)||'##同期',60,trim(class)||'tq_qty','0.00',0, 'center', 0,trim(class)||'_3',0 from session.results
     union all
     select distinct trim(name)||'##同比增量',60,trim(class)||'add_qty','0.00',0, 'center', 0,trim(class)||'_4',0 from session.results
     union all
     select distinct trim(name)||'##同比(%)',60,trim(class)||'tb_qty','0.00',0, 'center', 0,trim(class)||'_5',0 from session.results;
 

修改后 

INSERT INTO SESSION.captions(caption, width, property, format, fixcol, align, datatype, ordertag,TYPE)
    VALUES ('品牌',70,'tradename','',0, 'center', 0,'001',0)
    union all
     select distinct trim(case class when '00' then '合计' when '01' then '一等' when '02' then '二等' when '03' then '三等' when '04' then '四等' when '05' then '五等' end)||'##排名',60,trim(class)||'rank','',0, 'center', 0,trim(class)||'_1',0 from session.results
     union all
     select distinct trim(case class when '00' then '合计' when '01' then '一等' when '02' then '二等' when '03' then '三等' when '04' then '四等' when '05' then '五等' end)||'##本期',60,trim(class)||'bq_qty','0.00',0, 'center', 0,trim(class)||'_2',0 from session.results
     union all
     select distinct trim(case class when '00' then '合计' when '01' then '一等' when '02' then '二等' when '03' then '三等' when '04' then '四等' when '05' then '五等' end)||'##同期',60,trim(class)||'tq_qty','0.00',0, 'center', 0,trim(class)||'_3',0 from session.results
     union all
     select distinct trim(case class when '00' then '合计' when '01' then '一等' when '02' then '二等' when '03' then '三等' when '04' then '四等' when '05' then '五等' end)||'##同比增量',60,trim(class)||'add_qty','0.00',0, 'center', 0,trim(class)||'_4',0 from session.results
     union all
     select distinct trim(case class when '00' then '合计' when '01' then '一等' when '02' then '二等' when '03' then '三等' when '04' then '四等' when '05' then '五等' end)||'##同比(%)',60,trim(class)||'tb_qty','0.00',0, 'center', 0,trim(class)||'_5',0 from session.results;
     

 DECLARE v_captionCur1 CURSOR WITH RETURN TO CALLER FOR SELECT * FROM  SESSION.captions ORDER BY ordertag;
 DECLARE v_resultCur1 CURSOR WITH RETURN TO CALLER FOR SELECT * FROM  SESSION.results ORDER BY class,rank;
 

修改前显示

合计 一等 一等 一等 一等 一等 二等 二等 二等 二等 二等 三等 三等 三等 三等 三等 四等
排名 本期 同期 同比增量 同比(%) 排名 本期 同期 同比增量 同比(%) 排名 本期 同期 同比增量 同比(%) 排名 本期 同期 同比增量 同比(%) 排名 本期 同期 同比增量 同比(%)

 修改后显示

合计 一等 二等 三等 四等
排名 本期 同期 同比增量 同比(%) 排名 本期 同期 同比增量 同比(%) 排名 本期 同期 同比增量 同比(%) 排名 本期 同期 同比增量 同比(%) 排名 本期 同期 同比增量 同比(%)

猜你喜欢

转载自blog.csdn.net/m0_37392721/article/details/84754947
今日推荐