Hi Balram,
Create the main report, File -> New Report, select report template, update the filename from "Blank_A4_Landscape_3.jrxml" to "main.jrxml", click finish
Once the new main report is open in the designer drag and drop the "Subreport" Element from the Basic Elements List into the Detail Band.
The Subreport wizard should have opened, select "Create a new Report", select report template, update the filename from "Blank_A4_Landscape_3.jrxml" to "sdm.jrxml", click finish
Both reports should be open in your Jaspersoft Studio ( main.jrxml & sdm.jrxml )
[Create main.jrxml parameters]
<parameter name="p_finalstartdate" class="java.sql.Timestamp"/>
<parameter name="p_finalenddate" class="java.sql.Timestamp"/>
[Create main.jrxml variables]
<variable name="v_finalstartdate" class="java.lang.String" resetType="None">
<variableExpression><![CDATA["{ts'"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format($P{p_finalstartdate})+"'}"]]></variableExpression>
</variable>
<variable name="v_finalenddate" class="java.lang.String" resetType="None">
<variableExpression><![CDATA["{ts'"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format($P{p_finalenddate})+"'}"]]></variableExpression>
</variable>
[Update main.jrxml report query]
select distinct 1 + 2 as one
from cr
[Create sdm.jrxml parameters]
<parameter name="p_finalstartdate" class="String"/>
<parameter name="p_finalenddate" class="String"/>
On the main.jrxml select the subreport in the Detail Band, click on the properties tab and then click on Subreport and edit parameters (here you will link the main.jrxml variables with sdm.jrxml parameters)
[Update sdm.jrxml report query]
SELECT
cr.ref_num,
cr.id,
cr.open_date,
cr.priority_symbol,
cr.status_symbol,
cr.summary,
cr.web_url,
cr.customer_combo_name,
cr.assignee_combo_name,
cr.assignee_combo_name as ANALYST
FROM
cr
WHERE cr.type = 'R' and cr.active = 1 and cr.open_date >= $P{p_finalstartdate} and cr.open_date <= $P{p_finalenddate}
ORDER by ANALYST, cr.id DESC
Let you know should you not come right then I will create a example for you.
Regards,
Charl