数据集${if(,,,)}中,如何正确放置$getuserdepartments(1),以及嵌套?

求问,数据集中,在${if()}中,如何正确放置引用$getuserdepartments(1),以及在${if()}中嵌套使用$if()的正确写法是怎么样的?

${if(条件,"select * from A where clunm=$getuserdepartments(1)","select * from B where 1=1$if(条件),“and clunm=%getuserdepartments(1)”,"and clumn2= xxx"")}大概结构是这个样子

FineReport Maxizzz 发布于 2023-3-1 10:25 (编辑于 2023-3-1 10:31)
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共2回答
最佳回答
0
Z4u3z1Lv6专家互助
发布于2023-3-1 10:26(编辑于 2023-3-1 10:34)

首先你的 判断逻辑是什么?否则无法知晓怎么算正确

-------------

${if(条件1,"select * from A where clunm='"+getuserdepartments(1)+"'","select * from B where 1=1 "+if(统计2,"and clunm='"+getuserdepartments(1)+"'","and clumn2= xxx"))}

  • Maxizzz Maxizzz(提问者) ${if(条件,\"select * from A where clunm=$getuserdepartments(1)\",\"select * from B where 1=1 $if(条件),“and clunm=%getuserdepartments(1)”,\"and clumn2= xxx\" \")} 大概结构是这个样子
    2023-03-01 10:30 
  • Z4u3z1 Z4u3z1 回复 Maxizzz(提问者) 上面补充了
    2023-03-01 10:34 
最佳回答
0
snrtuemcLv8专家互助
发布于2023-3-1 10:32(编辑于 2023-3-1 10:35)

举例

${if(a=="1"," and 部门1='"+getuserdepartments(1)+",",if(b=="1",""," and 部门2='"+getuserdepartments(1)+","))}

==============

${if(条件,"select * from A where clunm='"+getuserdepartments(1)+"'","select * from B where 1=1"+if(条件,“and clunm='"+getuserdepartments(1)+"'”,"and clumn2= 'xxx'"))}

  • 1关注人数
  • 409浏览人数
  • 最后回答于:2023-3-1 10:35
    请选择关闭问题的原因
    确定 取消
    返回顶部