文档

Quick BI生成数据集的SQL占位符中${dateColumn.get(1)}不生效,接收不到查询控件传递过来的值

更新时间:
一键部署

问题描述

Quick BI生成数据集的SQL占位符中${dateColumn.get(1)}不生效,接收不到查询控件传递过来的值。生成数据集的SQL语句片段如下:

where
  per.is_current_month_performance = 'Y'
  and per.flag = 'Y'
  and per.order_code not like 'Y%'
  and per.order_code not like 'S%'
  and per.order_code is not null
  and per.order_code <> ''
  and per.performance_useflow_time >= '${x3.get(0)}'
  and per.performance_useflow_time <= '${x3.get(1)}' 

占位符定义截图如下:

图表日期范围查询控件和该占位符关联,传递值之后结束时间值不生效:

查看SQL,发现x3.get(1)不生效,没有接收到结束时间值:2022-05-17。

问题原因

生成数据集的SQL语句比较复杂时,where 语句中的过滤条件较多,需要将日期范围查询条件设置到第一个条件。

解决方案

SQL中where语句调整如下问题解决:

where
  per.performance_useflow_time >= '${x3.get(0)}'
  and per.performance_useflow_time <= '${x3.get(1)}' 
  and per.is_current_month_performance = 'Y'
  and per.flag = 'Y'
  and per.order_code not like 'Y%'
  and per.order_code not like 'S%'
  and per.order_code is not null
  and per.order_code <> ''

适用于

  • Quick BI
  • 本页导读
文档反馈