2002 JI Open Discussion Posted August 18, 2006 Share Posted August 18, 2006 By: Patria - phlukman passing params in query and subreports 2003-04-15 07:48 I am building a report ( MasterReport.xml) with a subreport ( ChildReport.xml). MasterReport.xml is as follows: ---------------------- <parameter name="SistemaCodigo" class="java.lang.String"/> <parameter name="Alias" class="java.lang.String"/> <queryString><![CDATA[sELECT sist_cod,SUBSTR(tage_nom,1,40) as tage_nom, SUBSTR(tage_alias,1,10) AS tage_alias,SUBSTR(tage_campo1,1,20) as tage_campo1,SUBSTR(tage_campo2,1,20) as tage_campo2, SUBSTR(tage_campo3,1,20) as tage_campo3 FROM tage WHERE sist_cod LIKE $P!{SistemaCodigo} AND tage_alias LIKE $P!{Alias} ORDER BY sist_cod,tage_nom ]]></queryString> <field name="tage_alias" class="java.lang.String"/> <subreport isUsingCache="true"> <reportElement ... isPrintWhenDetailOverflows="false"/> <subreportParameter name="Alias"> <subreportParameterExpression><![CDATA[ $F{tage_alias} ]]></subreportParameterExpression> </subreportParameter> <connectionExpression><![CDATA[ $P{REPORT_CONNECTION} ]]></connectionExpression> <subreportExpression class="dori.jasper.engine.JasperReport"><![CDATA[ $P{ProductsSubreport} ]]></subreportExpression> </subreport> -------------------------- ChildReport.xml is as follows: ----------------- <parameter name="Alias" isForPrompting="true" class="java.lang.String"/> <queryString><![CDATA[ SELECT tage_alias, vatg_cod,SUBSTR(vatg_des,1,40) as vatg_des,vatg_nom_variable,SUBSTR(vatg_valor1,1,20) as vatg_valor1, SUBSTR(vatg_valor2,1,20) as vatg_valor2,SUBSTR(vatg_valor3,1,20) as vatg_valor3, vatg_param,vatg_des_larga FROM vatg where tage_alias=$P{Alias} ORDER BY vatg_cod ]]></queryString> <field name="tage_alias ----------------------- In the calling program: parameters.put("SistemaCodigo","'AFI'"); parameters.put("Alias","'%'"); and I follow the proces of compilation and filling which works fine. The resulting .jasper file for this query is 1 MB aprox. When I am exporting the .jasper file to pdf format via JasperExportManager.exportReportToPdfFile(fileName); it seems it gets stuck, but it does not show any error. However, when I hardcode the values of SistemaCodigo and Alias as 'AFI' and '%' respectively within the MasterReport.xml the whole process works..... any hint? I would really appreciate it. Regards Patria Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now