不同的查询条件执行不同的SQL,控件复选框如何传参呢?

我想将and a.PRODUCT_ID ='T1Y10A0104PA00'    做成复选框,控件名为料号,不知道如何传参,我写的: ${if(len(料号)==0,'',"AND  a.PRODUCT_ID in ('"+料号+"')")}      结果报配置错误。请指教。下面判断的两段SQL中都有 and a.PRODUCT_ID ='T1Y10A0104PA00' 哦

SQL如下:

${if(OR ( 站点 != "17600" ,  站点 != "16600",  站点 != "19100")," select a.GE_TIME,a.PRODUCT_ID,a.EQUIPMENT_ID,a.LOT_ID,a.GLASS_ID,c.PROCESSOPERATIONNAME,c.MACHINENAME,c.CHAMBERNAME,b.PARA_NAME ietm,

                    AVG(b.VALUE) AS avgl,                                                                                                       

                    MAX(b.VALUE) AS maxl,                                                                                                       

                    MIN(b.VALUE) AS minl,                                                                                                         

                    max(decode(b.SITE, 1,b.value, 0)) as S01,                                                                                

                    max(decode(b.SITE, 2,b.value, 0)) as S02,                                                                                 

                    max(decode(b.SITE, 3,b.value, 0)) as S03,                                                                                 

                    max(decode(b.SITE, 4,b.value, 0)) as S04,                                                                                  

                    max(decode(b.SITE, 5,b.value, 0)) as S05,                                                                                  

                    max(decode(b.SITE, 6,b.value, 0)) as S06,                                                                                  

                    max(decode(b.SITE, 7,b.value, 0)) as S07,                                                                                  

                    max(decode(b.SITE, 8,b.value, 0)) as S08,                                                                                  

                    max(decode(b.SITE, 9,b.value, 0)) as S09,                                                                                  

                    max(decode(b.SITE, 10,b.value, 0)) as S10,                                                                                 

                    max(decode(b.SITE, 11,b.value, 0)) as S11,                                                                                 

                    max(decode(b.SITE, 12,b.value, 0)) as S12,                                                                                 

                    max(decode(b.SITE, 13,b.value, 0)) as S13,                                                                                 

                    max(decode(b.SITE, 14,b.value, 0)) as S14,                                                                                 

                    max(decode(b.SITE, 15,b.value, 0)) as S15,                                                                                 

                    max(decode(b.SITE, 16,b.value, 0)) as S16,                                                                                 

                    max(decode(b.SITE, 17,b.value, 0)) as S17,                                                                                 

                    max(decode(b.SITE, 18,b.value, 0)) as S18,                                                                                 

                    max(decode(b.SITE, 19,b.value, 0)) as S19,                                                                                 

                    max(decode(b.SITE, 20,b.value, 0)) as S20,                                                                                 

                    max(decode(b.SITE, 21,b.value, 0)) as S21,                                                                                 

                    max(decode(b.SITE, 22,b.value, 0)) as S22,                                                                                 

                    max(decode(b.SITE, 23,b.value, 0)) as S23,                                                                                 

                    max(decode(b.SITE, 24,b.value, 0)) as S24,                                                                                 

                    max(decode(b.SITE, 25,b.value, 0)) as S25                                                                                  

                    from P1DMSADM.teg_glass a,P1DMSADM.teg_site_info b ,P1DMSADM.ept_mmdchamberhistory c                                                                       

                    where                                                                                                                           

                    a.PRODUCT_ID=c.PRODUCTSPECNAME                                                                                                  

                    and a.GLASS_SEQ=b.GLASS_SEQ                                                                                                     

                    and a.GLASS_ID=c.GLASSNAME                                                                                                      

                    and a.LOT_ID=c.LOTNAME                                                                                                          

                    and a.STEP_ID='19700'                                                                                                           

                    and c.FACTORYNAME='A1'                                                                                                          

                    and a.PRODUCT_ID ='T1Y10A0104PA00'                                                                                            

                    and c.PROCESSOPERATIONNAME='12100'                                                                                             

                    and c.MACHINENAME='A1CVD100'                                                                                                   

                    --and c.CHAMBERNAME='" + chamber + "'                                                                                                 

                    and b.PARA_NAME in ('R2_SD_ITO')                                                                                    

                    --and a.GS_TIME between '20210913083000' and '20210913203000' 

                    and a.GS_TIME between to_char(to_date('" + 开始时间 + "','YYYY-MM-DD'),'YYYYMMDD')||'083000' and to_char(to_date('" + 结束时间 + "','YYYY-MM-DD')+1,'YYYYMMDD')||'083000' 

                    group by a.GE_TIME,a.PRODUCT_ID,a.EQUIPMENT_ID,a.LOT_ID,a.GLASS_ID,c.PROCESSOPERATIONNAME,c.MACHINENAME,c.CHAMBERNAME,b.PARA_NAME   

                    order by a.GLASS_ID,c.MACHINENAME,c.CHAMBERNAME,c.PROCESSOPERATIONNAME,b.PARA_NAME     ","select a.GE_TIME,a.PRODUCT_ID,a.EQUIPMENT_ID,a.LOT_ID,a.GLASS_ID,c.OLDPROCESSOPERATIONNAME,c.MACHINENAME,c.MATERIALLOCATIONNAME,b.PARA_NAME ietm,

                         AVG(b.VALUE) AS avgl,                                                                                                           

                         MAX(b.VALUE) AS maxl,                                                                                                     

                         MIN(b.VALUE) AS minl,                                                                                                     

                        max(decode(b.SITE, 1,b.value, 0)) as S01,                                                                                  

                        max(decode(b.SITE, 2,b.value, 0)) as S02,                                                                                  

                        max(decode(b.SITE, 3,b.value, 0)) as S03,                                                                                  

                        max(decode(b.SITE, 4,b.value, 0)) as S04,                                                                                  

                        max(decode(b.SITE, 5,b.value, 0)) as S05,                                                                                  

                        max(decode(b.SITE, 6,b.value, 0)) as S06,                                                                                  

                        max(decode(b.SITE, 7,b.value, 0)) as S07,                                                                                  

                        max(decode(b.SITE, 8,b.value, 0)) as S08,                                                                                  

                        max(decode(b.SITE, 9,b.value, 0)) as S09,                                                                                  

                       max(decode(b.SITE, 10,b.value, 0)) as S10,                                                                                  

                       max(decode(b.SITE, 11,b.value, 0)) as S11,                                                                                  

                       max(decode(b.SITE, 12,b.value, 0)) as S12,                                                                                  

                       max(decode(b.SITE, 13,b.value, 0)) as S13,                                                                                  

                       max(decode(b.SITE, 14,b.value, 0)) as S14,                                                                                  

                       max(decode(b.SITE, 15,b.value, 0)) as S15,                                                                                  

                       max(decode(b.SITE, 16,b.value, 0)) as S16,                                                                                  

                       max(decode(b.SITE, 17,b.value, 0)) as S17,                                                                                  

                       max(decode(b.SITE, 18,b.value, 0)) as S18,                                                                                  

                       max(decode(b.SITE, 19,b.value, 0)) as S19,                                                                                  

                       max(decode(b.SITE, 20,b.value, 0)) as S20,                                                                                  

                       max(decode(b.SITE, 21,b.value, 0)) as S21,                                                                                  

                       max(decode(b.SITE, 22,b.value, 0)) as S22,                                                                                  

                       max(decode(b.SITE, 23,b.value, 0)) as S23,                                                                                  

                       max(decode(b.SITE, 24,b.value, 0)) as S24,                                                                                  

                       max(decode(b.SITE, 25,b.value, 0)) as S25                                                                                   

                      from P1DMSADM.teg_glass a,P1DMSADM.teg_site_info b ,P1DMSADM.mes_producthistory c                                                                       

                      where                                                                                                                        

                         a.PRODUCT_ID=c.PRODUCTSPECNAME                                                                                            

                         and a.GLASS_SEQ=b.GLASS_SEQ                                                                                               

                         and a.GLASS_ID=c.PRODUCTNAME                                                                                              

                         and a.LOT_ID=c.LOTNAME                                                                                                    

                         and a.STEP_ID='19700'                                                                                                     

                         and c.FACTORYNAME='A1'                                                                                                    

                        and a.PRODUCT_ID ='T1Y10A0104PA00'                                                                 

                         and c.OLDPROCESSOPERATIONNAME='12100'                                                                              

                   and c.MACHINENAME='A1CVD100'                                                                                                    

                   --and c.MATERIALLOCATIONNAME='" + chamber + "'                                                                                                   

                     and b.PARA_NAME in ('R2_SD_ITO')                                                                                    

                       AND c.EVENTNAME='TrackOut'                                                                                  

                    --and a.GS_TIME between  '20210913083000' and '20210913203000' 

                     and a.GS_TIME BETWEEN to_char(SUBSTR(GS_TIME,1,8)||'08300000',YYYY/MM/DD)  AND to_char(SUBSTR(GS_TIME,1,8)||'20300000',YYYY-MM-DD)                                                                        

                    group by a.GE_TIME,a.PRODUCT_ID,a.EQUIPMENT_ID,a.LOT_ID,a.GLASS_ID,c.OLDPROCESSOPERATIONNAME,c.MACHINENAME,c.MATERIALLOCATIONNAME,b.PARA_NAME   

                    order by a.GLASS_ID,c.MACHINENAME,c.MATERIALLOCATIONNAME,c.OLDPROCESSOPERATIONNAME,b.PARA_NAME  ")}

FineReport 用户G8480957 发布于 2021-9-27 14:43 (编辑于 2021-9-27 19:56)
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共3回答
最佳回答
0
free_zzLv6中级互助
发布于2021-9-27 14:52

image.png

最佳回答
0
都义JLv5见习互助
发布于2021-9-27 16:26

${if(len(料号)==0,'',"AND  a.PRODUCT_ID in ('"+料号+"')")} 

${if(len(料号)==0,"","AND  a.PRODUCT_ID in ('"+料号+"')")} 

接双引号

还有复选框组件返回值类型字符串分隔符修改为','

最佳回答
0
StudyYLLv6初级互助
发布于2021-9-27 16:41

应该是参数嵌套的问题吧。

${if(OR ( 站点 != "17600" ,  站点 != "16600",  站点 != "19100")," select a.GE_TIME,a.PRODUCT_ID,a.EQUIPMENT_ID,a.LOT_ID,a.GLASS_ID,c.PROCESSOPERATIONNAME,c.MACHINENAME,c.CHAMBERNAME,b.PARA_NAME ietm,

                    AVG(b.VALUE) AS avgl,                                                                                                       

                    MAX(b.VALUE) AS maxl,                                                                                                       

                    MIN(b.VALUE) AS minl,                                                                                                         

                    max(decode(b.SITE, 1,b.value, 0)) as S01,                                                                                

                    max(decode(b.SITE, 2,b.value, 0)) as S02,                                                                                 

                    max(decode(b.SITE, 3,b.value, 0)) as S03,                                                                                 

                    max(decode(b.SITE, 4,b.value, 0)) as S04,                                                                                  

                    max(decode(b.SITE, 5,b.value, 0)) as S05,                                                                                  

                    max(decode(b.SITE, 6,b.value, 0)) as S06,                                                                                  

                    max(decode(b.SITE, 7,b.value, 0)) as S07,                                                                                  

                    max(decode(b.SITE, 8,b.value, 0)) as S08,                                                                                  

                    max(decode(b.SITE, 9,b.value, 0)) as S09,                                                                                  

                    max(decode(b.SITE, 10,b.value, 0)) as S10,                                                                                 

                    max(decode(b.SITE, 11,b.value, 0)) as S11,                                                                                 

                    max(decode(b.SITE, 12,b.value, 0)) as S12,                                                                                 

                    max(decode(b.SITE, 13,b.value, 0)) as S13,                                                                                 

                    max(decode(b.SITE, 14,b.value, 0)) as S14,                                                                                 

                    max(decode(b.SITE, 15,b.value, 0)) as S15,                                                                                 

                    max(decode(b.SITE, 16,b.value, 0)) as S16,                                                                                 

                    max(decode(b.SITE, 17,b.value, 0)) as S17,                                                                                 

                    max(decode(b.SITE, 18,b.value, 0)) as S18,                                                                                 

                    max(decode(b.SITE, 19,b.value, 0)) as S19,                                                                                 

                    max(decode(b.SITE, 20,b.value, 0)) as S20,                                                                                 

                    max(decode(b.SITE, 21,b.value, 0)) as S21,                                                                                 

                    max(decode(b.SITE, 22,b.value, 0)) as S22,                                                                                 

                    max(decode(b.SITE, 23,b.value, 0)) as S23,                                                                                 

                    max(decode(b.SITE, 24,b.value, 0)) as S24,                                                                                 

                    max(decode(b.SITE, 25,b.value, 0)) as S25                                                                                  

                    from P1DMSADM.teg_glass a,P1DMSADM.teg_site_info b ,P1DMSADM.ept_mmdchamberhistory c                                                                       

                    where                                                                                                                           

                    a.PRODUCT_ID=c.PRODUCTSPECNAME                                                                                                  

                    and a.GLASS_SEQ=b.GLASS_SEQ                                                                                                     

                    and a.GLASS_ID=c.GLASSNAME                                                                                                      

                    and a.LOT_ID=c.LOTNAME                                                                                                          

                    and a.STEP_ID='19700'                                                                                                           

                    and c.FACTORYNAME='A1'                                                                                                          

                    if(len(料号)==0,'',"AND  a.PRODUCT_ID in ('"+料号+"')")

--and a.PRODUCT_ID ='T1Y10A0104PA00'                                                                                            

                    and c.PROCESSOPERATIONNAME='12100'                                                                                             

                    and c.MACHINENAME='A1CVD100'                                                                                                   

                    --and c.CHAMBERNAME='" + chamber + "'                                                                                                 

                    and b.PARA_NAME in ('R2_SD_ITO')                                                                                    

                    --and a.GS_TIME between '20210913083000' and '20210913203000' 

                    and a.GS_TIME between to_char(to_date('" + 开始时间 + "','YYYY-MM-DD'),'YYYYMMDD')||'083000' and to_char(to_date('" + 结束时间 + "','YYYY-MM-DD')+1,'YYYYMMDD')||'083000' 

                    group by a.GE_TIME,a.PRODUCT_ID,a.EQUIPMENT_ID,a.LOT_ID,a.GLASS_ID,c.PROCESSOPERATIONNAME,c.MACHINENAME,c.CHAMBERNAME,b.PARA_NAME   

                    order by a.GLASS_ID,c.MACHINENAME,c.CHAMBERNAME,c.PROCESSOPERATIONNAME,b.PARA_NAME     ","select a.GE_TIME,a.PRODUCT_ID,a.EQUIPMENT_ID,a.LOT_ID,a.GLASS_ID,c.OLDPROCESSOPERATIONNAME,c.MACHINENAME,c.MATERIALLOCATIONNAME,b.PARA_NAME ietm,

                         AVG(b.VALUE) AS avgl,                                                                                                           

                         MAX(b.VALUE) AS maxl,                                                                                                     

                         MIN(b.VALUE) AS minl,                                                                                                     

                        max(decode(b.SITE, 1,b.value, 0)) as S01,                                                                                  

                        max(decode(b.SITE, 2,b.value, 0)) as S02,                                                                                  

                        max(decode(b.SITE, 3,b.value, 0)) as S03,                                                                                  

                        max(decode(b.SITE, 4,b.value, 0)) as S04,                                                                                  

                        max(decode(b.SITE, 5,b.value, 0)) as S05,                                                                                  

                        max(decode(b.SITE, 6,b.value, 0)) as S06,                                                                                  

                        max(decode(b.SITE, 7,b.value, 0)) as S07,                                                                                  

                        max(decode(b.SITE, 8,b.value, 0)) as S08,                                                                                  

                        max(decode(b.SITE, 9,b.value, 0)) as S09,                                                                                  

                       max(decode(b.SITE, 10,b.value, 0)) as S10,                                                                                  

                       max(decode(b.SITE, 11,b.value, 0)) as S11,                                                                                  

                       max(decode(b.SITE, 12,b.value, 0)) as S12,                                                                                  

                       max(decode(b.SITE, 13,b.value, 0)) as S13,                                                                                  

                       max(decode(b.SITE, 14,b.value, 0)) as S14,                                                                                  

                       max(decode(b.SITE, 15,b.value, 0)) as S15,                                                                                  

                       max(decode(b.SITE, 16,b.value, 0)) as S16,                                                                                  

                       max(decode(b.SITE, 17,b.value, 0)) as S17,                                                                                  

                       max(decode(b.SITE, 18,b.value, 0)) as S18,                                                                                  

                       max(decode(b.SITE, 19,b.value, 0)) as S19,                                                                                  

                       max(decode(b.SITE, 20,b.value, 0)) as S20,                                                                                  

                       max(decode(b.SITE, 21,b.value, 0)) as S21,                                                                                  

                       max(decode(b.SITE, 22,b.value, 0)) as S22,                                                                                  

                       max(decode(b.SITE, 23,b.value, 0)) as S23,                                                                                  

                       max(decode(b.SITE, 24,b.value, 0)) as S24,                                                                                  

                       max(decode(b.SITE, 25,b.value, 0)) as S25                                                                                   

                      from P1DMSADM.teg_glass a,P1DMSADM.teg_site_info b ,P1DMSADM.mes_producthistory c                                                                       

                      where                                                                                                                        

                         a.PRODUCT_ID=c.PRODUCTSPECNAME                                                                                            

                         and a.GLASS_SEQ=b.GLASS_SEQ                                                                                               

                         and a.GLASS_ID=c.PRODUCTNAME                                                                                              

                         and a.LOT_ID=c.LOTNAME                                                                                                    

                         and a.STEP_ID='19700'                                                                                                     

                         and c.FACTORYNAME='A1'      

                        if(len(料号)==0,'',"AND  a.PRODUCT_ID in ('"+料号+"')")                                                                                      

                        --and a.PRODUCT_ID ='T1Y10A0104PA00'                                                                 

                         and c.OLDPROCESSOPERATIONNAME='12100'                                                                              

                   and c.MACHINENAME='A1CVD100'                                                                                                    

                   --and c.MATERIALLOCATIONNAME='" + chamber + "'                                                                                                   

                     and b.PARA_NAME in ('R2_SD_ITO')                                                                                    

                       AND c.EVENTNAME='TrackOut'                                                                                  

                    --and a.GS_TIME between  '20210913083000' and '20210913203000' 

                     and a.GS_TIME BETWEEN to_char(SUBSTR(GS_TIME,1,8)||'08300000',YYYY/MM/DD)  AND to_char(SUBSTR(GS_TIME,1,8)||'20300000',YYYY-MM-DD)                                                                        

                    group by a.GE_TIME,a.PRODUCT_ID,a.EQUIPMENT_ID,a.LOT_ID,a.GLASS_ID,c.OLDPROCESSOPERATIONNAME,c.MACHINENAME,c.MATERIALLOCATIONNAME,b.PARA_NAME   

                    order by a.GLASS_ID,c.MACHINENAME,c.MATERIALLOCATIONNAME,c.OLDPROCESSOPERATIONNAME,b.PARA_NAME  ")}

  • 用户G8480957 用户G8480957(提问者) 参数嵌套问题怎么传参?
    2021-09-27 19:51 
  • StudyYL StudyYL 回复 用户G8480957(提问者) https://help.fanruan.com/finereport/doc-view-158.html#7 and a.PRODUCT_ID =\'T1Y10A0104PA00\'你这句怎么写的?
    2021-09-28 08:05 
  • 4关注人数
  • 400浏览人数
  • 最后回答于:2021-9-27 19:56
    请选择关闭问题的原因
    确定 取消
    返回顶部