passing mutiple parameters to Jasper Report

0

Hi,

I'm new to Jasper Report and currently supporting the already live reports on production for any enhancement / issues.

I need to paas multiple parameters to Jasper Reports. And don't know the syntax for same.

The below link is used to call a folder "Employment_Application" on server and pass a value of 100 to "id" parameter of each JRML file exists in that folder.

http://myserver.domain.com:8080/PDFReport/asdf.pdfreq?formtype=Employmen...

Queries:

1)  Though from above link its clear visible that we are passing a value of 100 to a parameter "id" but I checked the jrxml report and did not able to find this parameter defined anywhere. Instead there is a parameter name "REPORT_APPLICANT_ID" defined and getting this value 100 from this link and working perfectly. How is this "id=100" is linked to "REPORT_APPLICANT_ID" ?

"REPORT_APPLICANT_ID" has isForPrompting="true" property set.

2) I now have created one more parameter in report named "SUBREPORT_DIR" and need to pass a value to it at run time.

"SUBREPORT_DIR" has isForPrompting="false" property set and has been assigned a default value in report.

How can I pass the value to this parameter from above link along with current parameter ?

Please help me....

 

Code:
<?xml version="1.0" encoding="UTF-8"  ?>
<!-- Created with iReport - A designer for JasperReports -->
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport
		 name="Main"
		 columnCount="1"
		 printOrder="Vertical"
		 orientation="Portrait"
		 pageWidth="612"
		 pageHeight="792"
		 columnWidth="552"
		 columnSpacing="0"
		 leftMargin="30"
		 rightMargin="30"
		 topMargin="20"
		 bottomMargin="20"
		 whenNoDataType="NoPages"
		 isTitleNewPage="false"
		 isSummaryNewPage="false">
	<property name="ireport.scriptlethandling" value="0" />
	<property name="ireport.encoding" value="UTF-8" />
	<import value="java.util.*" />
	<import value="net.sf.jasperreports.engine.*" />
	<import value="net.sf.jasperreports.engine.data.*" />
 
	<parameter name="SUBREPORT_DIR" isForPrompting="false" class="java.lang.String">
		<defaultValueExpression ><![CDATA[".\\SubReports\\"]]></defaultValueExpression>
	</parameter>
	<parameter name="Report_Applicant_ID" isForPrompting="true" class="java.lang.Integer"/>
	<queryString><![CDATA[select 1 from dual]]></queryString>
 
	<field name="1" class="java.math.BigDecimal"/>
 
 
		<group  name="Group_Edu" >
			<groupExpression><![CDATA[$P{SUBREPORT_DIR}]]></groupExpression>
			<groupHeader>
			<band height="34"  isSplitAllowed="true" >
				<subreport  isUsingCache="true">
					<reportElement
						x="-17"
						y="0"
						width="569"
						height="34"
						key="subreport-1"/>
					<subreportParameter  name="Report_Applicant_ID">
						<subreportParameterExpression><![CDATA[$P{Report_Applicant_ID}]]></subreportParameterExpression>
					</subreportParameter>
					<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
					<subreportExpression  class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "Education_History.jasper"]]></subreportExpression>
				</subreport>
			</band>
			</groupHeader>
			<groupFooter>
			<band height="0"  isSplitAllowed="true" >
			</band>
			</groupFooter>
		</group>
</td></tr></tbody></table>
ravijain's picture
Joined: Oct 16 2008 - 9:06am
Last seen: 6 years 2 weeks ago

2 Answers:

0
Please check the place where you are compiling and generating the report. At time of generating the report, you need to pass the hash map of parameters which will be evaluted in jasper layers for parameters. So i guess , some code might be retriving value from query string and setting in hash map with key Report_Applicant_ID. the same way you can pass value for your SUBREPORT_DIR parameter.
akash12_06's picture
Joined: Oct 1 2008 - 2:57am
Last seen: 6 years 1 month ago
0

Can you help me where I can lookup for Hash Maps ? FYI, We have deployed a custom webservice on Tomcat which calls JasperReports engine. Unfortunately that webservice is created by some other vendor and I don't know any whereabouts of that.

ravijain's picture
Joined: Oct 16 2008 - 9:06am
Last seen: 6 years 2 weeks ago
Feedback
randomness