Forum Discussion

gsugunan's avatar
gsugunan
Occasional Contributor
13 years ago

empty result from a datasink

with the following testcase report code:
<jasperReport xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xs ... report.xsd" name="ReportTemplate" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30" xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<property name="ireport.encoding" value="UTF-8"/>
<template>"../../styles.jrtx"</template>
<!--FIELDS & PARAMS-->
<title>
<band height="70">
<textField>
<reportElement x="159" y="13" width="229" height="42"/>
<textElement>
<font size="26"/>
</textElement>
<textFieldExpression class="java.lang.String">$F{name} + " Report"</textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band/>
</pageHeader>
<detail>
<band height="122">
<staticText>
<reportElement style="MainHeader" x="0" y="0" width="535" height="35"/>
<textElement/>
<text>DataSink report</text>
</staticText>
<!--SUBREPORTS UNDER HERE-->
<subreport isUsingCache="true">
<reportElement positionType="Float" isPrintRepeatedValues="false" x="0" y="0" width="500" height="30"/>
<dataSourceExpression>$P{DataSinksSubReport}</dataSourceExpression>
<subreportExpression>"subreport:testCaseSubRep"</subreportExpression>
</subreport>
</band>
</detail>
</jasperReport>

using the following subreport code:

<jasperReport xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xs ... report.xsd" name="report name" language="groovy" pageWidth="535" pageHeight="842" columnWidth="535" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<template>"../../styles.jrtx"</template>
<field name="runtime" class="java.lang.String"/>
<columnHeader>
<band height="59">
<staticText>
<reportElement style="ColumnHeader" x="0" y="35" width="122" height="20"/>
<textElement textAlignment="Left" verticalAlignment="Middle"/>
<text>runtime</text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="21">
<textField>
<reportElement x="0" y="1" width="122" height="20"/>
<textElement textAlignment="Left" verticalAlignment="Top"/>
<textFieldExpression class="java.lang.String">$F{runtime}</textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>

it's empty, even though viewing the data sink itself shows it contains data

by empty I mean the report compiles fine, but shows nothing; so why is the report empty when the datasink contains values?

3 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi!

    hmm.. is the name of the DataSink TestStep in your TestCase exactly"DataSinksSubReport" ?

    /Ole
    SmartBear Software
  • gsugunan's avatar
    gsugunan
    Occasional Contributor
    that's the really weird part, I called it DataSink, but the subreport menu, when showing available data sources only shows DataSinksSubReport; if I use DataSink it just gives an error because DataSink doesn't exist (parameter not found error)