Jump to content
We've recently updated our Privacy Statement, available here ×

Subreport doesn't show up


2005 IR Help

Recommended Posts

By: primarykey - primarykey

Subreport doesn't show up

2004-12-30 00:54

Hi. I have a report and a subreport in it. But the subreport doesn't show up. Master report, subreport,custom datasource and my action are shown below:

 

Master Report

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

 

<?xml version="1.0" encoding="UTF-8"?>

<!-- Created with iReport - A designer for JasperReports -->

<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "D:WSAD5WorkspacesOgrenciIsleriOgrenciIsleriWebWebContentWEB-INFjasperreport.dtd">

<jasperReport name="AskerlikFormu" columnCount="1" printOrder="Vertical" orientation="Portrait" pageWidth="595" pageHeight="842" columnWidth="535" columnSpacing="0" leftMargin="30" rightMargin="0" topMargin="28" bottomMargin="85" whenNoDataType="AllSectionsNoDetail" isTitleNewPage="false" isSummaryNewPage="false">

 

<reportFont name="Arial_Normal" size="10" isDefault="true" pdfFontName="fonts/arial.ttf" pdfEncoding="Identity-H" isPdfEmbedded="true"/>

<reportFont name="Arial_Small" size="9" isDefault="true" pdfFontName="fonts/arial.ttf" pdfEncoding="Identity-H" isPdfEmbedded="true"/>

<reportFont name="Arial_Smaller" size="8" isDefault="true" pdfFontName="fonts/arial.ttf" pdfEncoding="Identity-H" isPdfEmbedded="true"/>

<reportFont name="Arial_Smallest" size="7" isDefault="true" pdfFontName="fonts/arial.ttf" pdfEncoding="Identity-H" isPdfEmbedded="true"/>

 

 

<parameter name="AskerlikFormuDonemleriSubreportDataSource" class="net.sf.jasperreports.engine.JRDataSource"/>

<parameter name="AskerlikFormuDonemleriSubreport" isForPrompting="true" class="net.sf.jasperreports.engine.JasperReport"/>

 

 

<background>

<band height="0" isSplitAllowed="true">

</band>

</background>

<title>

<band height="40" isSplitAllowed="true">

</band>

</title>

<pageHeader>

<band height="0" isSplitAllowed="true">

</band>

</pageHeader>

<columnHeader>

<band height="450" isSplitAllowed="true">

</band>

</columnHeader>

<detail>

 

<band height="15" isSplitAllowed="true">

 

<subreport isUsingCache="true">

<reportElement mode="Opaque" x="0" y="0" width="100" height="15" forecolor="#000000" backcolor="#FFFFFF" key="element-10" positionType="FixRelativeToTop" isPrintRepeatedValues="false" isRemoveLineWhenBlank="false" isPrintWhenDetailOverflows="true"/>

<parametersMapExpression><![CDATA[$P{REPORT_PARAMETERS_MAP}]]></parametersMapExpression>

<dataSourceExpression><![CDATA[$P{AskerlikFormuDonemleriSubreportDataSource}]]></dataSourceExpression>

<subreportExpression class="dori.jasper.engine.JasperReport">

$P{AskerlikFormuDonemleriSubreport}

</subreportExpression>

</subreport>

 

</band>

 

</detail>

<columnFooter>

<band height="0" isSplitAllowed="true">

</band>

</columnFooter>

<pageFooter>

<band height="0" isSplitAllowed="true">

</band>

</pageFooter>

<summary>

<band height="0" isSplitAllowed="true">

 

</band>

</summary>

</jasperReport>

 

Subreport

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

<?xml version="1.0" encoding="UTF-8"?>

<!-- Created with iReport - A designer for JasperReports -->

<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "D:WSAD5WorkspacesOgrenciIsleriOgrenciIsleriWebWebContentWEB-INFjasperreport.dtd">

<jasperReport name="AskerlikFormuDonemleri" columnCount="1" printOrder="Vertical" orientation="Portrait" pageWidth="595" pageHeight="842" columnWidth="535" columnSpacing="0" leftMargin="30" rightMargin="0" topMargin="28" bottomMargin="85" whenNoDataType="AllSectionsNoDetail" isTitleNewPage="false" isSummaryNewPage="false">

 

<reportFont name="Arial_Normal" size="10" isDefault="true" pdfFontName="fonts/arial.ttf" pdfEncoding="Identity-H" isPdfEmbedded="true"/>

<reportFont name="Arial_Small" size="9" isDefault="true" pdfFontName="fonts/arial.ttf" pdfEncoding="Identity-H" isPdfEmbedded="true"/>

<reportFont name="Arial_Smaller" size="8" isDefault="true" pdfFontName="fonts/arial.ttf" pdfEncoding="Identity-H" isPdfEmbedded="true"/>

<reportFont name="Arial_Smallest" size="7" isDefault="true" pdfFontName="fonts/arial.ttf" pdfEncoding="Identity-H" isPdfEmbedded="true"/>

 

<parameter name="AskerlikFormuDonemleriSubreportDataSource" class="net.sf.jasperreports.engine.JRDataSource"/>

<parameter name="AskerlikFormuDonemleriSubreport" isForPrompting="true" class="net.sf.jasperreports.engine.JasperReport"/>

 

<field name="OgretimDonemi" class="java.lang.String"/>

<field name="Yariyil" class="java.lang.Short"/>

<field name="Standing" class="java.lang.String"/>

 

<background>

<band height="0" isSplitAllowed="true">

</band>

</background>

<title>

<band height="0" isSplitAllowed="true">

</band>

</title>

<pageHeader>

<band height="0" isSplitAllowed="true">

</band>

</pageHeader>

<columnHeader>

<band height="0" isSplitAllowed="true">

</band>

</columnHeader>

<detail>

<band height="15" isSplitAllowed="true">

 

<line direction="TopDown">

<reportElement

mode="Opaque"

x="0"

y="0"

width="250"

height="0"

forecolor="#000000"

backcolor="#FFFFFF"

key="element-330"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<graphicElement pen="Thin" fill="Solid" />

</line>

 

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None">

<reportElement mode="Opaque" x="41" y="1" width="60" height="13" forecolor="#000000" backcolor="#FFFFFF" key="element-25" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font reportFont="Arial_Normal"/>

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$F{OgretimDonemi}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None">

<reportElement mode="Opaque" x="111" y="1" width="60" height="13" forecolor="#000000" backcolor="#FFFFFF" key="element-25" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font reportFont="Arial_Normal"/>

</textElement>

<textFieldExpression class="java.lang.Short"><![CDATA[$F{Yariyil}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None">

<reportElement mode="Opaque" x="181" y="1" width="60" height="13" forecolor="#000000" backcolor="#FFFFFF" key="element-25" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false"/>

<textElement textAlignment="Left" verticalAlignment="Top" lineSpacing="Single">

<font reportFont="Arial_Normal"/>

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$F{Standing}]]></textFieldExpression>

</textField>

</band>

</detail>

<columnFooter>

<band height="0" isSplitAllowed="true">

</band>

</columnFooter>

<pageFooter>

<band height="0" isSplitAllowed="true">

</band>

</pageFooter>

<summary>

<band height="0" isSplitAllowed="true">

</band>

</summary>

</jasperReport>

 

Datasource

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

 

public class DataSourceAskerlik implements JRDataSource {

 

private Object[] obj;

private int index = -1;

 

public DataSourceAskerlik(Object[] object) {

super();

this.obj = object;

}

 

public boolean next() throws JRException {

index++;

return (index < obj.length);

}

 

public Object getFieldValue(JRField field) throws JRException {

Object value = null;

String fieldName = field.getName();

KarneDTO dto = (KarneDTO)obj[index];

 

if ("OgretimDonemi".equals(fieldName)) {

value = (Object)dto.getOgretimDonemi();

}else if("Yariyil".equals(fieldName)){

value = new Short(dto.getYariyil());

}else if("Standing".equals(fieldName)){

if(dto.getStanding().equalsIgnoreCase("Satisfactory") || dto.getStanding().equalsIgnoreCase("Honour") || dto.getStanding().equalsIgnoreCase("High Honour"))

value = "GEÇ”İ";

else if(dto.getStanding().equalsIgnoreCase("Unsatisfactory"))

value = "KALDI";

else value = "DEVAM";

}

return value;

}

}

 

Action

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

Collection ogrenciOgrenimDurumBilgileri = transkriptControllerDelegate.findOgrenciOgrenimDurumBilgileri(ogrenciDTO.getOgrenciNo());

 

JasperReport askerlikFormuDonemleriSubreport=RaporlarConfigUtil.compileStringReport(askerlikFormuDonemleriSubreportcompileDir, askerlikFormuDonemleriSubreportfile, this);

JasperReport masterreport=RaporlarConfigUtil.compileStringReport(compileDir, file, this);

 

DataSourceAskerlik ds = new DataSourceAskerlik(ogrenciOgrenimDurumBilgileri.toArray());

 

RaporlarConfigUtil.fillReport(askerlikFormuDonemleriSubreport,parameters,ds);

 

parameters.put("AskerlikFormuDonemleriSubreportDataSource", ds);

parameters.put("AskerlikFormuDonemleriSubreport", askerlikFormuDonemleriSubreport);

 

File reportFile = new File(RaporlarConfigUtil.getJasperFilePath(this, compileDir, file+".jasper"));

 

byte[] reportContent = RaporlarConfigUtil.getReport(parameters, reportFile,ds);

RaporlarConfigUtil.writeReport(response, reportContent);

 

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

This is the simplification of my code. I tried to put a static text in my subreport. But it also doesn't show up. Please help me.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...