2015-09-08 102 views
0

如何將主報表字段傳遞給子報表查詢。 主要報告查詢:如何將主報表字段傳遞給子報表查詢

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爲IDDIM')在報表查詢在條件:

(WHERE indi.ID_INDICE = $P{INDICE} AND piv.VIGENCIA = $P{VIGENCIA} AND pd.ID_DIMENSION = Here I want use) 

回答

0

U需要將參數pd.ID_DIMENSION傳遞給子報表。

  1. 在您的主要報告中,單擊子報表上的屬性,單擊參數。
  2. 它會帶參數框。點擊添加,輸入參數名稱,例如:ID_DIMENSION
  3. 的價值體現,選擇你想傳遞給子報表如現場:$F{ID_DIMENSION}
  4. 在您的子報告
  5. ,添加新的Paramater它同樣只是什麼ü從主報表傳遞,和名稱,ID_DIMENSION
  6. 改變你的子報告查詢以使用主報告中的參數。 ... AND pd.ID_DIMENSION = $P{ID_DIMENSION}

祝你好運。

+0

謝謝你這麼多gDeGreat .. 它的工作。 –

+0

我還有其他問題。 你在嗎? –

+0

是的,我還在這裏 – ggDeGreat

相關問題