Skip to Content
0
Former Member
Jul 20, 2009 at 08:57 AM

各位大师请问这个问题如何解决,一个rpt文件里面多个command的问题

55 Views

每类报表(比如工作量)都分年,月,日,周,时段报表,每类报表的最终展现都是一样的,只是数据库表不一样,数据粒度是一样的。

所以只做了一个rpt,然后对年,月,日,周,时都建立了一个command(commad的sql中也有判断,这样不会造成资源太浪费);然后在公式里进行判断,然后把公式拖放到报表页面上。在报表设计器里面直接运行是可以实现我的要求的。但最后通过JSP去调用的时候就无法显示数据了,只能每个rpt一个comand才能有数据出来,不知道怎么回事情;

看下面的sql和公式就应该明白我的意思了,每个sql里面都有

(select 'Daily' from dual)='{?ReportType}' ReportType就是我jsp传递的参数。

cmdDaily(SQL):

select

oag.OBJECT_NAME,

oag.PRESENTATION_NAME ,

vag.SUM_N_INBOUND,

vag.SUM_N_INTERNAL,

vag.SUM_N_CONFERENCES ,

vag.SUM_N_OUTBOUND ,

vag.SUM_N_TRANSFERS_MADE,

vag.SUM_N_TRANSFERS_TAKEN ,

vag.SUM_N_INBOUND + vag.SUM_N_OUTBOUND as SUM_Call

from

o_agent_day oag ,

(select

OBJECT_ID,

sum(N_INBOUND) as SUM_N_INBOUND,

sum(N_INTERNAL) as SUM_N_INTERNAL,

sum(N_CONFERENCES) as SUM_N_CONFERENCES,

sum(N_OUTBOUND) as SUM_N_OUTBOUND,

sum(N_TRANSFERS_MADE) as SUM_N_TRANSFERS_MADE,

sum(N_TRANSFERS_TAKEN) as SUM_N_TRANSFERS_TAKEN

from

v_agent_day

where

TIME_KEY in (select TIME_KEY from t_agent_day where

(select 'Daily' from dual)='{?ReportType}'

and QUERY_DATE=to_char({?StartDate},'YYYYMMDD'))

and object_id in ({?Advisors})

group by OBJECT_ID

) vag

where

oag.object_id = vag.object_id

order by oag.OBJECT_NAME

cmdMonthly(SQL):

select

oag.OBJECT_NAME,

oag.PRESENTATION_NAME,

vag.SUM_N_INBOUND,

vag.SUM_N_INTERNAL,

vag.SUM_N_CONFERENCES,

vag.SUM_N_OUTBOUND,

vag.SUM_N_TRANSFERS_MADE,

vag.SUM_N_TRANSFERS_TAKEN,

vag.SUM_N_INBOUND + vag.SUM_N_OUTBOUND as SUM_CALL

from

o_agent_month oag ,

(where 。。。。。。。。。。

TIME_KEY in (select TIME_KEY from t_agent_month where

(select 'Monthly' from dual)='{?ReportType}'

and QUERY_FROM <= to_char({?StartDate},'YYYYMMDD') and QUERY_TO>= to_char({?StartDate},'YYYYMMDD')

。。。。。。。。 )

公式字段(OBJECT_NAME):其它类推

if {?ReportType}='Monthly' then

{CmdMonthly.OBJECT_NAME}

else if {?ReportType}='Daily' then ,然后将这些字段拖到报表页面上

{CmdDaily.OBJECT_NAME}