公式里的变量

红框部分变量这么写对吗

image.png

代码:IF(  count(split($p_cx, ",")) = count(split($p_cx_bz, ",")),   sql("DR_NMS_SQL_SERVER","SELECT REPLACE(ZGOAL1,'%','')  as  ZGOAL1 FROM dbo.ZNMS_GOAL WHERE MATKL = 'GZQTL'",1,1),  sql("DR_NMS_SQL_SERVER","select round(sum(rate)/count(matkl),2) as pj FROM  (  select   MATKL,  ready_all,   ready_y,  (case when ready_all = 0 THEN 0 ELSE  cast(cast(ready_y  * 1.0 / ready_all as decimal(18,3)) * 100  as decimal(18,1)) END )as rate  from (  SELECT   MATKL,  COUNT(READY) AS ready_all,  COUNT(case when READY = 'Y' then 1 end) AS ready_y  FROM [dbo].[ZNMS_JIT_H1]   WHERE Z1STMP1 IN (SELECT  Z1STMP1       FROM dbo.ZNMS_JIT_H1      WHERE DATEPART(DW,Z1STMP1)=2       GROUP BY Z1STMP1)      "+if(len(p_cx)==0,"","and matkl in ( '"+p_cx+"' )")+"      "+if(len(p_dateEditor0)==0,"","and Z1MON >= '"+p_dateEditor0+"'")+"      "+if(len(p_dateEditor1)==0,"","and Z1MON <= '"+p_dateEditor1+"'")+"      AND STWEK<= ( case when (CONVERT(BIGINT,(right(Z1WEK,2)))+${p_numberEditor0})

改:

image.png

FineReport 狂奔的小蜗牛 发布于 2022-12-30 12:58 (编辑于 2022-12-30 13:35)
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共2回答
最佳回答
0
Z4u3z1Lv6专家互助
发布于2022-12-30 13:01(编辑于 2022-12-30 14:08)

 前面都用引号了后面怎么不用??

结果还不止一处啊~~~

IF(  count(split($p_cx, ",")) = count(split($p_cx_bz, ",")),   sql("DR_NMS_SQL_SERVER","SELECT REPLACE(ZGOAL1,'%','')  as  ZGOAL1 FROM dbo.ZNMS_GOAL WHERE MATKL = 'GZQTL'",1,1),  sql("DR_NMS_SQL_SERVER","select round(sum(rate)/count(matkl),2) as pj FROM  (  select   MATKL,  ready_all,   ready_y,  (case when ready_all = 0 THEN 0 ELSE  cast(cast(ready_y  * 1.0 / ready_all as decimal(18,3)) * 100  as decimal(18,1)) END )as rate  from (  SELECT   MATKL,  COUNT(READY) AS ready_all,  COUNT(case when READY = 'Y' then 1 end) AS ready_y  FROM [dbo].[ZNMS_JIT_H1]   WHERE Z1STMP1 IN (SELECT  Z1STMP1       FROM dbo.ZNMS_JIT_H1      WHERE DATEPART(DW,Z1STMP1)=2       GROUP BY Z1STMP1)      "+if(len(p_cx)==0,"","and matkl in ( '"+p_cx+"' )")+"      "+if(len(p_dateEditor0)==0,"","and Z1MON >= '"+p_dateEditor0+"'")+"      "+if(len(p_dateEditor1)==0,"","and Z1MON <= '"+p_dateEditor1+"'")+"      AND STWEK<= ( case when (CONVERT(BIGINT,(right(Z1WEK,2)))+"+$p_numberEditor0+")

-----------

image.png

  • 狂奔的小蜗牛 狂奔的小蜗牛(提问者) 就是把${p_numberEditor0} 全改成 \"+$p_numberEditor0+\" 被
    2022-12-30 13:29 
  • 狂奔的小蜗牛 狂奔的小蜗牛(提问者) 但是你看颜色变黄了呢
    2022-12-30 13:33 
  • Z4u3z1 Z4u3z1 回复 狂奔的小蜗牛(提问者) 变色大多数能表示公式正误,但复杂也它也不能检查出来。你直接实时计算一下嘛
    2022-12-30 14:11 
最佳回答
0
CD20160914Lv8专家互助
发布于2022-12-30 13:02

+$p_numberEditor0

全改成这样就行了

  • 狂奔的小蜗牛 狂奔的小蜗牛(提问者) 不用加引号之类的吗
    2022-12-30 13:38 
  • CD20160914 CD20160914 回复 狂奔的小蜗牛(提问者) 不加。。。
    2022-12-30 13:39 
  • CD20160914 CD20160914 回复 狂奔的小蜗牛(提问者) 你的前面要加,你只要替换成这样就行了
    2022-12-30 13:39 
  • 2关注人数
  • 270浏览人数
  • 最后回答于:2022-12-30 14:08
    请选择关闭问题的原因
    确定 取消
    返回顶部