yzmnts5e2849120(提问者)模板参数默认值:SQL("mysql", "SELECT DISTINCT SUBSTR(monitor_cycle, 1, 4) AS yr
FROM 表1
WHERE area = '${权限大区}'
ORDER BY SUBSTR(monitor_cycle, 1, 4) DESC LIMIT 1", 1, 1) 然后数据集里:select distinct
customer_id,
customer_name,
energy_consumption_theoretical_progress_discrepancy,
energy_consumption_theoretical_value_progress_yc,
energy_consumption_theoretical_value_progress_sj
from 表1
where ds = replace(date_sub(current_date(), interval 1 day),'-','')
and substr(monitor_cycle,1,4) = '${yr}'
${if(len(权限大区) == 0,"","and area in ('" + 权限大区 + "')")}
order by customer_id
yzmnts5e2849120(提问者)设置了,模板参数默认值:SQL("mysql", "SELECT DISTINCT SUBSTR(monitor_cycle, 1, 4) AS yr
FROM 表1
WHERE area = '${权限大区}'
ORDER BY SUBSTR(monitor_cycle, 1, 4) DESC LIMIT 1", 1, 1)
yzmnts5e2849120(提问者) 回复 snrtuemc是的加了过滤就不对了,因为这个默认值是带权限管控的...只能写参数,请问下如果有这种权限管控,这个筛选框模板参数的默认值应该怎么写呀。我的数据集是这么写的:select distinct
customer_id,
customer_name,
energy_consumption_theoretical_progress_discrepancy,
energy_consumption_theoretical_value_progress_yc,
energy_consumption_theoretical_value_progress_sj
from 表1
where ds = replace(date_sub(current_date(), interval 1 day),'-','')
and substr(monitor_cycle,1,4) = '${yr}'
${if(len(权限大区) == 0,"","and area in ('" + 权限大区 + "')")}
order by customer_id
yzmnts5e2849120(提问者)改成:SQL("mysql", "SELECT DISTINCT SUBSTR(monitor_cycle, 1, 4) AS yr
FROM 表1
WHERE area = "+$area_qx+"
ORDER BY SUBSTR(monitor_cycle, 1, 4) DESC LIMIT 1", 1, 1) 好像也不行...不知道初始化显示默认值到底该怎么做,没办法写死默认值
江思成 回复 yzmnts5e2849120(提问者)我看上面那么多的交流,我复述一下你的需求,数据集里的是你主体数据,想通过权限大区取到yr,然后yr再回传到你主体数据集里是吗?如果是这样的,你可以使用(SELECT DISTINCT SUBSTR(monitor_cycle, 1, 4) AS yr
FROM 表1
WHERE area = "+$area_qx+"
ORDER BY SUBSTR(monitor_cycle, 1, 4) DESC LIMIT 1) 代替 你主体数据集sql里的 '${yr}' ,这样就能实现你的功能,如果你想进行调试,可以设置模板参数,para1设置成 area_qx(权限大区),值设置为南部