Hi, I am trying to write a custom report with a subreport within the
detail band.
detail band have several text fields and a subreport node as follows:

Code:
--------------------

<detail>
<band height="41">
<textField isBlankWhenNull="false" isStretchWithOverflow="true" pattern="">
<reportElement height="12" isPrintWhenDetailOverflows="true" key="textField-8" mode="Transparent" width="118" x="19" y="0"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA["<font color="+ $V{color} +">"+ ($F{event_field1} != null ? $F{event_field1}.toString() : $V{NA} ) +"</font>"]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true" pattern="">
<reportElement forecolor="#808080" height="11" isPrintWhenDetailOverflows="true" key="textField-10" mode="Transparent" positionType="Float" width="118" x="19" y="12"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, $P{REPORT_LOCALE}).format($F{event_parse_time})]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="false" isStretchWithOverflow="true">
<reportElement height="11" isPrintWhenDetailOverflows="true" key="textField-11" mode="Transparent" width="99" x="120" y="0"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[( $F{event_field2} == null ? $V{NA} : $F{event_field2}.toString() )]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="false" isStretchWithOverflow="true">
<reportElement height="11" isPrintWhenDetailOverflows="true" key="textField-29" mode="Transparent" width="99" x="220" y="0"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[( $F{event_field3} == null ? $V{NA} : $F{event_field3}.toString() )]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="false" isStretchWithOverflow="true">
<reportElement height="11" isPrintWhenDetailOverflows="true" key="textField-30" mode="Transparent" width="109" x="320" y="1"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[( $F{event_field4} == null ? $V{NA} : $F{event_field4}.toString() )]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="false" isStretchWithOverflow="true">
<reportElement height="11" isPrintWhenDetailOverflows="true" key="textField-31" mode="Transparent" width="109" x="430" y="0"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[( $F{event_field5} == null ? $V{NA} : $F{event_field5}.toString() )]]></textFieldExpression>
</textField>
<subreport isUsingCache="true">
<reportElement height="20" isPrintWhenDetailOverflows="true" key="subreport-2" mode="Opaque" width="390" x="120" y="12"/>
<subreportParameter name="ReportType">
<subreportParameterExpression><![CDATA[$P{ReportType}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="FromDate">
<subreportParameterExpression><![CDATA[$P{FromDtQry}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="ToDate">
<subreportParameterExpression><![CDATA[$P{ToDtQry}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="EventField1">
<subreportParameterExpression><![CDATA[$P{EventField1}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="PLUGIN_DIRECTORY">
<subreportParameterExpression><![CDATA[$P{PLUGIN_DIRECTORY}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="SEARCH_TARGETS">
<subreportParameterExpression><![CDATA[$P{SEARCH_TARGETS}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="INITIATING_USER">
<subreportParameterExpression><![CDATA[$P{INITIATING_USER}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression class="java.lang.String"><![CDATA["TemplateGroupSummary.jasper"]]></subreportExpression>
</subreport>
</band>
</detail>
--------------------


In the subreport I need to a find a single event (last login event of
the user) and print related data such as MAC addr and Host Name.

My subreport definition is as follows:


Code:
--------------------
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bottomMargin="0" columnWidth="552" leftMargin="0" name="TemplateGroupSummary" orientation="Landscape" pageHeight="48" pageWidth="552" resourceBundle="TemplateGroupSummary" rightMargin="0" scriptletClass="com.novell.sentinel.content.report s.TemplateReportScriptlet" topMargin="0" whenNoDataType="AllSectionsNoDetail" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd">
<property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="ireport.scriptlethandling" value="2"/>
<property name="ireport.encoding" value="UTF-8"/>
<import value="net.sf.jasperreports.engine.*"/>
<import value="java.text.*"/>
<import value="java.util.*"/>
<import value="net.sf.jasperreports.engine.data.*"/>
<parameter class="com.novell.sentinel.content.reports.Templat eReportScriptlet" isForPrompting="false" name="VALIDATED_SCRIPTLET">
<defaultValueExpression><![CDATA[new com.novell.sentinel.content.reports.TemplateReport Scriptlet()]]></defaultValueExpression>
</parameter>
<parameter class="java.lang.String" isForPrompting="false" name="FromDate">
<defaultValueExpression><![CDATA[$P{VALIDATED_SCRIPTLET}.DatePrepare($P{ReportType} ,"F",((new SimpleDateFormat("dd/MM/yyyy HH:mm:ss")).format(new Date())),"")]]></defaultValueExpression>
</parameter>
<parameter class="java.lang.String" isForPrompting="false" name="ToDate">
<defaultValueExpression><![CDATA[$P{VALIDATED_SCRIPTLET}.DatePrepare($P{ReportType} ,"T",((new SimpleDateFormat("dd/MM/yyyy HH:mm:ss")).format(new Date())),"")]]></defaultValueExpression>
</parameter>
<parameter class="java.lang.String" name="ReportType">
<parameterDescription><![CDATA[D - Current Day, PD - Previous Day, W - Week To Date, PW - Previous Week, M - Month To Date, PM - Previous Month, DR - Custom Date Range]]></parameterDescription>
<defaultValueExpression><![CDATA["DR"]]></defaultValueExpression>
</parameter>
<parameter class="java.lang.String" isForPrompting="false" name="PLUGIN_DIRECTORY">
<parameterDescription><![CDATA[Location of plugin files]]></parameterDescription>
<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
</parameter>
<parameter class="java.lang.String" isForPrompting="false" name="SEARCH_TARGETS">
<defaultValueExpression><![CDATA["[Local](--LOCALHOST--)"]]></defaultValueExpression>
</parameter>
<parameter class="java.lang.String" isForPrompting="false" name="INITIATING_USER">
<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
</parameter>
<parameter class="java.lang.String" name="EventField1"/>
<parameter class="java.lang.String" isForPrompting="false" name="LUCENE_REPORT_QUERY">
<defaultValueExpression><![CDATA[$R{NOT_AVAILABLE}]]></defaultValueExpression>
</parameter>
<queryString language="LUCENE_EVENT">
<![CDATA[SELECT
dt as loginTime,
smac as sourceMAC,
shn as sourceHN,
WHERE euid:"$P{EventField1}" AND evt:"UYAP_T_GNL_LOGIN"
OVER $P{FromDate}, $P{ToDate}
MAXCOUNT=1]]>
</queryString>
<field class="java.util.Date" name="loginTime"/>
<field class="java.lang.Object" name="sourceMAC"/>
<field class="java.lang.Object" name="sourceHN"/>
<sortField name="loginTime" order="Descending"/>
<variable class="java.lang.String" name="NA">
<variableExpression><![CDATA[($P{REPORT_SCRIPTLET}.UNKNOWN).toString()]]></variableExpression>
<initialValueExpression><![CDATA[($P{REPORT_SCRIPTLET}.UNKNOWN).toString()]]></initialValueExpression>
</variable>
<variable class="java.lang.Object" name="KEYS_COLORS" resetType="None">
<variableExpression><![CDATA[$P{REPORT_SCRIPTLET}.getKeyColors()]]></variableExpression>
<initialValueExpression><![CDATA[$P{REPORT_SCRIPTLET}.getKeyColors()]]></initialValueExpression>
</variable>
<background>
<band/>
</background>
<title>
<band/>
</title>
<pageHeader>
<band/>
</pageHeader>
<columnHeader>
<band height="20">
<textField>
<reportElement height="17" mode="Transparent" width="100" x="1" y="1"/>
<textElement markup="html" verticalAlignment="Middle">
<font fontName="Arial" size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{sourceHN}]]></textFieldExpression>
</textField>
<textField>
<reportElement height="17" mode="Transparent" width="100" x="101" y="0"/>
<textElement markup="html" verticalAlignment="Middle">
<font fontName="Arial" size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{sourceMAC}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true" isStretchWithOverflow="true">
<reportElement backcolor="#F6F5F5" forecolor="#000000" height="14" isPrintRepeatedValues="false" key="textField-35" mode="Opaque" width="349" x="203" y="1"/>
<textElement markup="html" verticalAlignment="Middle">
<font fontName="Arial" size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[java.text.MessageFormat.format("QUERY:", new Object[] {$P{LUCENE_REPORT_QUERY}})]]></textFieldExpression>
</textField>
</band>
</columnHeader>
<detail>
<band/>
</detail>
<columnFooter>
<band/>
</columnFooter>
<pageFooter>
<band/>
</pageFooter>
<summary>
<band/>
</summary>
</jasperReport>

--------------------


Main report prints properly as epected but the subreport field of every
main report line displays "null".
What am I doing wrong?
Thanks for any help.


--
hkalyoncu
------------------------------------------------------------------------
hkalyoncu's Profile: https://forums.netiq.com/member.php?userid=3117
View this thread: https://forums.netiq.com/showthread.php?t=47506