Jasper_table_pass parameter to table component

 1 <subDataset name="Dataset1" uuid="2a894ef4-dbcc-47df-bfaf-027766c7352e">
 2         <parameter name="PARAMS_PROVIDER" class="com.citi.gfts.rptapp.jasper.writer.JRParamsProvider"/>
 3         <parameter name="P_YEAR" class="java.lang.String"/>
 4         <queryString language="CSV">
 5             <![CDATA[]]>
 6         </queryString>
 7         <field name="SELECTED_PERIOD" class="java.lang.String"/>
 8 ......
 9 </subDataset>
10 <parameter name="PARAMS_PROVIDER" class="com.citi.gfts.rptapp.jasper.writer.JRParamsProvider" isForPrompting="false"/>
11 <queryString language="CSV">
12 <![CDATA[]]>
13 </queryString>
14 <field name="SELECTED_PERIOD" class="java.lang.String"/>

 

1 <datasetRun subDataset="Dataset1" uuid="4d921887-ca07-4e67-be57-09ca48c843d1">
2     <datasetParameter name="PARAMS_PROVIDER">
3         <datasetParameterExpression><![CDATA[$P{PARAMS_PROVIDER}]]></datasetParameterExpression>
4     </datasetParameter>
5     <datasetParameter name="P_YEAR">
6         <datasetParameterExpression><![CDATA[$P{PARAMS_PROVIDER}.getQueryParams().get("P_FISCAL_YEAR")==null?"-":$P{PARAMS_PROVIDER}.getQueryParams().get("P_FISCAL_YEAR")]]></datasetParameterExpression>
7     </datasetParameter>
8     <dataSourceExpression><![CDATA[$P{PARAMS_PROVIDER}.getDataSource("ds1")]]></dataSourceExpression>
9 </datasetRun>

 

 

1) create required parameters in the main report by right clicking on the parameters section of main report------> add parameter-------->set the properties (data type) of newly added parameter to your desired one.

2) create equivalent parameters in the table/List's data source's parameters section exactly as in step 1.

3) from report explorer, right click on the table and click on Edit Table DataSet ------> clickthe parameters button----------->Click add ---------->Choose the parameter (which you created in the dataset's parameter section in step 1) from upper combo (i.e. Dataset parameter name) ------> then click on lower button (i.e.) assign value expression i.e. the params which you added in step 1.

posted @ 2016-10-21 11:14  天天好心情啊  阅读(235)  评论(0编辑  收藏  举报