如何将主报表字段传递给子报表查询。 主报告查询:
select pd.ID_DIMENSION as IDDIM,
pd.NOMBRE as pdnombre,
pdi.VALOR_PONDERACION_GOB as pdipond,
pdi.VALOR_PONDERADO as pdiponderado
from pgs_indice pi
join pgh_indice_vigencia piv on piv.ID_INDICE = pi.ID_INDICE
JOIN pgh_dimension_indice pdi ON piv.ID_INDICE_VIGENCIA = pdi.ID_INDICE_VIGENCIA
JOIN pgb_dimension pd ON pd.ID_DIMENSION = pdi.ID_DIMENSION
where pi.ID_INDICE = $P{INDICE} AND piv.VIGENCIA = $P{VIGENCIA}
子报告查询:
SELECT DISTINCT pc.NOMBRE as pcnombre,
pcd.VALOR_PONDERACION_GOB as pcdpond,
pcd.VALOR_PONDERACION as pcdponderacion,
FORMAT(((pcd.VALOR_PONDERACION_GOB * 100) / (pcd.VALOR_PONDERACION_GOB + pcd.VALOR_PONDERACION)),2) as pcdpondgobcal,
FORMAT(((pcd.VALOR_PONDERACION * 100) / (pcd.VALOR_PONDERACION_GOB + pcd.VALOR_PONDERACION)),2) as pcdpondcal
FROM pgs_indice indi
JOIN pgh_indice_vigencia piv ON piv.ID_INDICE = indi.ID_INDICE
JOIN pgh_dimension_indice pdi ON piv.ID_INDICE_VIGENCIA = pdi.ID_INDICE_VIGENCIA
JOIN pgb_dimension pd ON pd.ID_DIMENSION =pdi.ID_DIMENSION
JOIN pgh_categoria_dimension pcd ON pcd.ID_DIMENSION_INDICE = pdi.ID_DIMENSION_INDICE
JOIN pgb_categoria pc ON pc.ID_CATEGORIA = pcd.ID_CATEGORIA
JOIN pgh_indicador_categoria pic ON pic.ID_CATEGORIA_DIMENSION = pcd.ID_CATEGORIA_DIMENSION
JOIN pgb_indicador pi ON pi.ID_INDICADOR = pic.ID_INDICADOR
WHERE indi.ID_INDICE = $P{INDICE}
AND piv.VIGENCIA = $P{VIGENCIA}
AND pd.ID_DIMENSION =1 Here
我希望在子报表查询中使用主报表字段('pd.ID_DIMENSION as IDDIM,')where condition:
(WHERE indi.ID_INDICE = $P{INDICE} AND piv.VIGENCIA = $P{VIGENCIA} AND pd.ID_DIMENSION = Here I want use)
答案 0 :(得分:0)
你需要将参数pd.ID_DIMENSION传递给子报告。
ID_DIMENSION
。$F{ID_DIMENSION}
ID_DIMENSION
... AND pd.ID_DIMENSION = $P{ID_DIMENSION}