I want to pass my parameter value from main report to the sub report.
I have tried many ways. Also I have tried options from this link as well passing-parameters-from-main-report-to-subreport-to-subreport-in-jasper
Main report
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0 -->
<!-- 2016-01-03T00:04:36 -->
<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="parademo" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="4949f116-97b5-453c-8581-61ccb1b3159e">
<parameter name="TITLEPARA" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["hi title"]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[]]>
</queryString>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch">
<textField>
<reportElement x="180" y="36" width="220" height="30" uuid="4ac55979-2248-45d2-a001-3c82b5fec56b"/>
<textFieldExpression><![CDATA[$P{TITLEPARA}]]></textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="286" splitType="Stretch">
<subreport runToBottom="false">
<reportElement x="0" y="86" width="560" height="74" uuid="eca8556b-2d65-462f-a3d3-ac95ea6e3ebf"/>
<subreportParameter name="TITLEPARA">
<subreportParameterExpression><![CDATA[$P{TITLEPARA}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["file:/home/rectrix/workspace/jasper/subparam.jrxml"]]></subreportExpression>
</subreport>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
Sub-Report
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0 -->
<!-- 2016-01-03T00:04:17 -->
<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="subparam" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="b4c019e3-0dc2-425c-b449-908c4fd21bde">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="MainReportDataSet"/>
<parameter name="TITLEPARA" class="java.lang.String" isForPrompting="false"/>
<queryString>
<![CDATA[]]>
</queryString>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch">
<textField>
<reportElement x="140" y="45" width="100" height="30" uuid="6b9d5038-4163-47ed-a0cd-812f07b27ff0"/>
<textFieldExpression><![CDATA[$P{TITLEPARA}]]></textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="125" splitType="Stretch"/>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
I am able to print "HI TITLE" Using the parameter in my main report's title
band.
I want to pass this value to the sub-report using the parameter and print it on the title
band of the sub-report.
I want to pass this value using a parameter only, because I want to know how the parameters works so I could use it for my project to pass the values to sub-report through parameters.