如何让筛选控件可以实现关联查询和独立查询(无关联关系)

请输入任务描述

FineReport 吕爱慧 发布于 2020-5-8 13:43
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共4回答
最佳回答
0
吕爱慧Lv6初级互助
发布于2020-5-11 08:36

select DISTINCT EQPGROUP,EQPID,LOCATION,target  from (with temp as(SELECT TO_CHAR(TO_DATE(HISTDATE,'YYYYMMDD'),'YYYYMM') MONTH,
'W'||TO_CHAR(TO_DATE(HISTDATE,'YYYYMMDD')+5,'YYWW') WEEK,
HISTDATE,EQPID,EQPTYPE,LOCATION,
case when (RUN_TIME+BKUP_TIME+IDLE_TIME+LOST_TIME+TEST_TIME+TEST_CW_TIME+SUSPD_TIME+WAIT_MFG_TIME+WAIT_ENG_TIME+HOLD_ENG_TIME+
DOWN_TIME+MON_DOWN_TIME+FAC_TIME+PM_TIME+MON_PM_TIME+MON_R_TIME+CIM_TIME+PROCESS_PM_TIME+OFF_TIME)=0 then 0
else (RUN_TIME+BKUP_TIME+IDLE_TIME+LOST_TIME+TEST_TIME+TEST_CW_TIME+SUSPD_TIME)/
(RUN_TIME+BKUP_TIME+IDLE_TIME+LOST_TIME+TEST_TIME+TEST_CW_TIME+SUSPD_TIME+WAIT_MFG_TIME+WAIT_ENG_TIME+HOLD_ENG_TIME+
DOWN_TIME+MON_DOWN_TIME+FAC_TIME+PM_TIME+MON_PM_TIME+MON_R_TIME+CIM_TIME+PROCESS_PM_TIME+OFF_TIME)
END AS UPTIMES
FROM SDB_TB_EQP_HIST
where histdate >= to_char(sysdate-90,'YYYYMMDD')  
and (eqpid like 'A%' OR EQPID LIKE 'B%')
ORDER BY TO_CHAR(TO_DATE(HISTDATE,'YYYYMMDD'),'YYYYMM'),TO_CHAR(TO_DATE(HISTDATE,'YYYYMMDD'),'YYWW')
,HISTDATE,EQPID,EQPTYPE,LOCATION)

SELECT A.type,A.histdate,B.EQPGROUP,A.eqpid,B.TARGET,A.EQPTYPE, A.LOCATION,A.UPTIME FROM (
select 'DAY' type,histdate,eqpid,EQPTYPE, LOCATION, ROUND(avg(UPTIMES),4) UPTIME from temp WHERE HISTDATE >= TO_CHAR(TRUNC(SYSDATE-7-0.3125),'YYYYMMDD')
group by histdate,eqpid,EQPTYPE, LOCATION) a
left outer join
(SELECT EQPGROUP, EQPID, TARGET FROM SXRPTUSER.M1_TB_EQPMONITOR_MAINTAIN) B
ON A.EQPID = B.EQPID
order by location,EQPGROUP,eqpid)  WHERE 1=1
${if(len(LOCATION) == 0,"","and LOCATION = '" +LOCATION + "'")}
${if(len(EQPID) == 0,"","and EQPID = '" +EQPID + "'")}
${if(len(EQPGROUP) == 0,"","and EQPGROUP = '" +EQPGROUP + "'")}
order by EQPGROUP,EQPID,LOCATION

最佳回答
0
18328816101Lv5中级互助
发布于2020-5-8 13:48

参数联动

https://help.finereport.com/doc-view-412.html

控件的数据字典之间没有关联性,就是独立查询

最佳回答
0
cherry团子Lv6中级互助
发布于2020-5-8 13:48

下拉框参数联动:

https://help.finereport.com/doc-view-1284.html

无关联不是直接用控件就好了吗 ='${参数}'

最佳回答
0
读书人Lv5初级互助
发布于2020-5-8 13:52

直接在sql里加上就可以实现查询,不知道是不是误解你的意思了?

where 1=1 
${if(len(参数1)==0,"","and 字段 = '"+参数1+"' ")}
${if(len(参数2)==0,"","and 字段 = '"+参数2+"' ")}


  • 3关注人数
  • 803浏览人数
  • 最后回答于:2020-5-11 08:36
    请选择关闭问题的原因
    确定 取消
    返回顶部