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

javax_slr

Members
  • Posts

    3
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Posts posted by javax_slr

  1. Thank you,

    Now I changed the design using nested reports and different datasources, but still I have infinite loop problem.

     Take a look please

     

     

    Code:
    ------level 0 report -----------------------------<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"><jasperReport name="BasicReport">    <import value="com.cadence.mdv.reporting.ReportUtilities" />    <parameter name="DSFactory" class="com.cadence.mdv.reporting.JasperDataSourceFactory" />    <parameter name="Title" class="java.lang.String" />       <title>        <band height="50">            <textField>                <reportElement x="0" y="0" width="200" height="50" />                <textFieldExpression class="java.lang.String">$P{Title}</textFieldExpression>            </textField>        </band>    </title>    <pageHeader>        <band>        </band>    </pageHeader>    <detail>        <band height="600" isSplitAllowed="true">            <subreport>                <reportElement x="50" y="0" height="300" width="500" isPrintWhenDetailOverflows="true" />                <dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression>                <subreportExpression class="java.lang.String"><![CDATA["blockdetails.jasper"]]>    </subreportExpression>            </subreport>          </band>    </detail></jasperReport>------level 1 report -----------------------------<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN"  "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"><jasperReport name="BlockDetailReport">	<import value="com.cadence.mdv.reporting.ReportUtilities"/>	<import value="com.cadence.mdv.model.MDVCoverageContainer"/>	<parameter name="Title" class="java.lang.String" />	<parameter name="DSFactory" class="com.cadence.mdv.reporting.JasperDataSourceFactory" />		<queryString><![CDATA[select entity from dto]]></queryString>	<field name="entity" class="com.cadence.mdv.model.MDVBaseEntity" />	<variable name="NAME" class="java.lang.String" calculation="Sum">		<variableExpression>			$F{entity}.getAttributeValue("name")		</variableExpression>	</variable>			<detail>		<band height="500"   isSplitAllowed="true">			<rectangle>				<reportElement mode="Opaque" x="50" y="0" width="420" height="20" backcolor="#CCCCCC"/>			</rectangle>			<rectangle>				<reportElement mode="Transparent" x="50" y="20" width="420" height="250" backcolor="#FFFFFF"/>			</rectangle>			<staticText>				<reportElement mode="Transparent" x="61" y="5" width="200" height="20" backcolor="#FFFFFF"/>				<textElement>					<font fontName="SansSerif" size="10" isBold="true"/>				</textElement>				<text><![CDATA[block coverage for Instance:]]></text>			</staticText>			<textField>				<reportElement mode="Transparent" x="279" y="5" width="130" height="20" backcolor="#FFFFFF"/>				<textElement>					<font fontName="SansSerif" isBold="true"/>				</textElement>				<textFieldExpression class="java.lang.String"><![CDATA[$V{NAME}]]></textFieldExpression>			</textField>			<staticText>				<reportElement x="61" y="39" width="100" height="20"/>				<textElement/>				<text><![CDATA[Covered Blocks:]]></text>			</staticText>			<textField>				<reportElement x="161" y="39" width="130" height="20"/>				<textElement/>				<textFieldExpression class="java.lang.String"><![CDATA[ReportUtilities.createHitOfTotal($F{entity},"selfBlock")]]></textFieldExpression>			</textField>			<staticText>				<reportElement x="61" y="59" width="100" height="20"/>				<textElement/>				<text><![CDATA[ignored Blocks:]]></text>			</staticText>						<textField>				<reportElement x="161" y="59" width="130" height="20"/>				<textElement/>				<textFieldExpression class="java.lang.String"><![CDATA[ReportUtilities.createIgnored($F{entity},"selfBlock")]]></textFieldExpression>			</textField>									<staticText>				<reportElement x="61" y="79" width="100" height="20"/>				<textElement/>				<text><![CDATA[Covered Statements:]]></text>			</staticText>			<textField>				<reportElement x="161" y="79" width="107" height="20"/>				<textElement/>				<textFieldExpression class="java.lang.String"><![CDATA[ReportUtilities.createHitOfTotal($F{entity},"selfStatement")]]></textFieldExpression>			</textField>						<staticText>				<reportElement x="61" y="99" width="100" height="20"/>				<textElement/>				<text><![CDATA[ignored Statements:]]></text>			</staticText>			<textField>				<reportElement x="161" y="99" width="107" height="20"/>				<textElement/>				<textFieldExpression class="java.lang.String"><![CDATA[ReportUtilities.createIgnored($F{entity},"selfStatement")]]></textFieldExpression>			</textField>						<staticText>				<reportElement x="61" y="119" width="100" height="20"/>				<textElement/>				<text><![CDATA[Covered Branches:]]></text>			</staticText>			<textField>				<reportElement x="161" y="119" width="107" height="20"/>				<textElement/>				<textFieldExpression class="java.lang.String"><![CDATA[ReportUtilities.createHitOfTotal($F{entity},"selfBranch")]]></textFieldExpression>			</textField>						<staticText>				<reportElement x="61" y="139" width="100" height="20"/>				<textElement/>				<text><![CDATA[ignored Branches:]]></text>			</staticText>			<textField>				<reportElement x="161" y="139" width="107" height="20"/>				<textElement/>				<textFieldExpression class="java.lang.String"><![CDATA[ReportUtilities.createIgnored($F{entity},"selfBranch")]]></textFieldExpression>			</textField>			<subreport>				<reportElement x="50" y="0" height="300" width="500" isPrintWhenDetailOverflows="true" />				<dataSourceExpression><![CDATA[$P{DSFactory}.createBlockDS((MDVCoverageContainer)$F{entity})]]></dataSourceExpression>				<subreportExpression class="java.lang.String"><![CDATA["blockdetailsblock.jasper"]]>	</subreportExpression>			</subreport>		</band>	</detail>		</jasperReport>--------------- level 2 report ----------------------------------<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN"  "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"><jasperReport name="BlockDetailReport">	<import value="com.cadence.mdv.reporting.ReportUtilities"/>	<queryString><![CDATA[select block from cc]]></queryString>	<field name="entity" class="com.cadence.mdv.model.MDVBlock" />			<detail>		<band height="300"   isSplitAllowed="true">									<textField>				<reportElement x="20" y="20" width="40" height="20"/>				<textElement/>				<textFieldExpression class="java.lang.String"><![CDATA[ReportUtilities.createHitOfTotal($F{entity},"count")]]></textFieldExpression>			</textField>											</band>	</detail>		</jasperReport>-----------  My data source ----------package com.cadence.mdv.reporting;import java.util.List;import net.sf.jasperreports.engine.JRException;import net.sf.jasperreports.engine.JRField;import net.sf.jasperreports.engine.JRRewindableDataSource;import com.cadence.mdv.api.IMDVDatasetServices;import com.cadence.mdv.model.MDVBaseEntity;import com.cadence.mdv.model.MDVListDataSet;import com.cadence.mdv.model.query.MDVSliceDefinition;import com.cadence.mdv.util.logging.MDVLogger;final public class DTOJRDataSource implements JRRewindableDataSource {    @SuppressWarnings("unused")    private static MDVLogger __logger = MDVLogger.getLogger(DTOJRDataSource.class);      private final MDVListDataSet      _data;    private final static int          SLICE_SIZE = 1000;    private int                       _index;    private int                       _sliceNum;    private List<MDVBaseEntity>       _slice;    private final IMDVDatasetServices _service;    public DTOJRDataSource(final MDVListDataSet data, final IMDVDatasetServices service) {        _data = data;        _service = service;        _slice = _service.getSlice(_data, new MDVSliceDefinition(0, SLICE_SIZE)).getEntities();        _index = 0;        _sliceNum = 0;    }    public Object getFieldValue(final JRField arg0) throws JRException {        return _slice.get(_index);    }    public void moveFirst() throws JRException {        _slice = _service.getSlice(_data, new MDVSliceDefinition(0, SLICE_SIZE)).getEntities();        _index = 0;        _sliceNum = 0;    }    public boolean next() throws JRException {        _index++;        if (_index >= _slice.size()) {            if (_slice.size() < SLICE_SIZE) {                return false;            }            _sliceNum++;            _slice = _service.getSlice(_data,                                       new MDVSliceDefinition(SLICE_SIZE * _sliceNum, SLICE_SIZE)).getEntities();            _index = 0;        }        return true;    }}
  2. Hi! I'm trying create a report with Jasper reports, which contains 2 subreports, working on the same data source (which is custom data source). I.e. those subreports are working on the same data. I have following "main" report jrxml (attached code snippet) and I receive exception: com.cadence.mdv.reporting.ReportingException: net.sf.jasperreports.engine.JRException: The subreport is placed on a non-splitting band, but it does not have a rewindable data source. What should I do in order to get this report working? Thank you


     

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN"
     "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

    <jasperReport name="BasicReport">
           
    <import value="com.cadence.mdv.reporting.ReportUtilities" />
           
    <parameter name="Title" class="java.lang.String" />
           
    <title>
                   
    <band height="50">
                           
    <textField>
                                   
    <reportElement x="0" y="0" width="200" height="50" />
                                   
    <textFieldExpression class="java.lang.String">$P{Title}</textFieldExpression>
                           
    </textField>
                   
    </band>
           
    </title>
           
    <pageHeader>
                   
    <band>
                   
    </band>
           
    </pageHeader>
           
    <detail>
                   
    <band height="620" isSplitAllowed="true">
                           
    <subreport>
                                   
    <reportElement x="50" y="0" height="300" width="500" isPrintWhenDetailOverflows="true" />
                                   
    <dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression>
                                   
    <subreportExpression class="java.lang.String"><![CDATA["blockdetails.jasper"]]> </subreportExpression>
                           
    </subreport>
                           
    <subreport>
                                   
    <reportElement x="50" y="0" height="300" width="500" isPrintWhenDetailOverflows="true" />
                                   
    <dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression>
                                   
    <subreportExpression class="java.lang.String"><![CDATA["fsmdetails.jasper"]]>   </subreportExpression>
                           
    </subreport>
                   
    </band>
           
    </detail>
    </jasperReport>[/code]

×
×
  • Create New...