rapthor Posted July 6, 2010 Share Posted July 6, 2010 Hello,I am passing parameters to a report which works just fine. But when I access the same parameters in a subquery of the report they are just empty.PARAM_1 is the parameter I am accessing in the main report. In my subquery PARAM_1 keeps its default value which is an empty String.I am passing the params via:params.put("PARAM_1", "PERSONS");params.put("PARAM_2", "CARS");print = JasperFillManager.fillReport(reportFile, params, conn);Why are these parameters empty in the subquery?Code: <?xml version="1.0" encoding="UTF-8"?><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Control Level Security Status Report" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isSummaryWithPageHeaderAndFooter="true"> <subDataset name="sub_query1"> <parameter name="PARAM_1" class="java.lang.String"> <defaultValueExpression><![CDATA[""]]></defaultValueExpression> </parameter> <parameter name="PARAM_2" class="java.lang.String"> <defaultValueExpression><![CDATA[""]]></defaultValueExpression> </parameter> <queryString> <![CDATA[select * from $P!{PARAM_1}]]> </queryString> <field name="NAME" class="java.lang.String"> <fieldDescription><![CDATA[]]></fieldDescription> </field> </subDataset> <parameter name="PARAM_1" class="java.lang.String"> <defaultValueExpression><![CDATA[""]]></defaultValueExpression> </parameter> <parameter name="PARAM_2" class="java.lang.String"> <defaultValueExpression><![CDATA[""]]></defaultValueExpression> </parameter>..... Link to comment Share on other sites More sharing options...
lucianc Posted July 7, 2010 Share Posted July 7, 2010 Parameter values are not automatically passed to subqueries. You'll need to explicitly add <datasetParameter>s inside the <datasetRun>, or use <parametersMapExpression> to pass bulk parameter values.Regards,Lucian 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