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

Empty report when using parameters


msaifee786

Recommended Posts

 Hi all, 

I'm using JasperServer 3.7.0 for Linux (on CentOS 5.0). I've just recently started using JasperServer so I'm a little inexperienced.

 

I'm trying to set up a report that takes in 3 mandatory parameters (specifically, a start/end date and an ID hash). These parameters are used in the SQL statement that brings down the data for the report. However, whenever I specify the parameters and run the report, JasperServer returns that the report is empty. If I change the jrxml so that the dates and ID hash are hardcoded into the SQL, then it returns the correct data. 

For the parameters, I've specified the dates as a 'date' datatype and the ID hash as a 'text' datatype. I've tried to surround the ID hash with quotes in the SQL statement (returns an error because Jasper can't parse the $P{} syntax when quotes surround it) and entering the quotes when JasperServer asks for the parameters when running the report (no difference, still returns an empty report). 

I've double checked against the database from which I'm pulling the data, and data does exist, so in the correct case JasperServer should be returning something. 

I've also attached the jrxml as code in case the problem is with that (though, it was generate by iReport).

Any idea what might be causing this, or how to solve the problem? Any help would be greatly appreciated. Thanks very much!

 

Murtaza

Code:
<?xml version="1.0" encoding="UTF-8"?><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="geolucid_pub_countrystats" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">	<property name="ireport.zoom" value="1.0"/>	<property name="ireport.x" value="0"/>	<property name="ireport.y" value="0"/>	<parameter name="STARTDATE" class="java.lang.String"/>	<parameter name="ENDDATE" class="java.lang.String"/>	<parameter name="PWEBID" class="java.lang.String"/>	<queryString language="SQL">		<![CDATA[sELECT geo_lucid_hourly.p_website_id,pub_site_snap_daily.site_name,geo_lucid_hourly.country_code,geo_lucid_hourly.requests,geo_lucid_hourly.fills,geo_lucid_hourly.impressions,geo_lucid_hourly.p_micro_rev FROM geo_lucid_hourly JOIN pub_site_snap_daily ON (geo_lucid_hourly.p_website_id = pub_site_snap_daily.p_website_id AND DATE(geo_lucid_hourly.datetime) = pub_site_snap_daily.date) WHERE geo_lucid_hourly.datetime >= $P{STARTDATE} AND geo_lucid_hourly.datetime < $P{ENDDATE} AND geo_lucid_hourly.p_website_id = $P{PWEBID} GROUP BY p_website_id,country_code]]>	</queryString>	<field name="p_website_id" class="java.lang.String"/>	<field name="site_name" class="java.lang.String"/>	<field name="country_code" class="java.lang.String"/>	<field name="requests" class="java.lang.Long"/>	<field name="fills" class="java.lang.Long"/>	<field name="impressions" class="java.lang.Long"/>	<field name="p_micro_rev" class="java.lang.Long"/>	<background>		<band splitType="Stretch"/>	</background>	<title>		<band height="44" splitType="Stretch">			<staticText>				<reportElement x="195" y="0" width="463" height="32"/>				<textElement textAlignment="Justified">					<font size="20" isBold="true"/>				</textElement>				<text><![CDATA[Geolucid Data by Publisher and Country]]></text>			</staticText>		</band>	</title>	<pageHeader>		<band height="20" splitType="Stretch">			<staticText>				<reportElement x="0" y="0" width="289" height="20"/>				<textElement>					<font size="12" isBold="true" isUnderline="true"/>				</textElement>				<text><![CDATA[Publisher Website ID]]></text>			</staticText>			<staticText>				<reportElement x="289" y="0" width="182" height="20"/>				<textElement>					<font size="12" isBold="true" isUnderline="true"/>				</textElement>				<text><![CDATA[Publisher Website Name]]></text>			</staticText>			<staticText>				<reportElement x="471" y="0" width="61" height="20"/>				<textElement>					<font size="12" isBold="true" isUnderline="true"/>				</textElement>				<text><![CDATA[Country]]></text>			</staticText>			<staticText>				<reportElement x="532" y="0" width="69" height="20"/>				<textElement>					<font size="12" isBold="true" isUnderline="true"/>				</textElement>				<text><![CDATA[Requests]]></text>			</staticText>			<staticText>				<reportElement x="601" y="0" width="47" height="20"/>				<textElement>					<font size="12" isBold="true" isUnderline="true"/>				</textElement>				<text><![CDATA[Fills]]></text>			</staticText>			<staticText>				<reportElement x="648" y="0" width="89" height="20"/>				<textElement>					<font size="12" isBold="true" isUnderline="true"/>				</textElement>				<text><![CDATA[impressions]]></text>			</staticText>			<staticText>				<reportElement x="737" y="0" width="59" height="20"/>				<textElement>					<font size="12" isBold="true" isUnderline="true"/>				</textElement>				<text><![CDATA[Revenue]]></text>			</staticText>		</band>	</pageHeader>	<columnHeader>		<band splitType="Stretch"/>	</columnHeader>	<detail>		<band height="25" splitType="Stretch">			<textField>				<reportElement x="0" y="0" width="289" height="20"/>				<textElement/>				<textFieldExpression class="java.lang.String"><![CDATA[$F{p_website_id}]]></textFieldExpression>			</textField>			<textField>				<reportElement x="289" y="0" width="182" height="20"/>				<textElement/>				<textFieldExpression class="java.lang.String"><![CDATA[$F{site_name}]]></textFieldExpression>			</textField>			<textField>				<reportElement x="471" y="0" width="61" height="20"/>				<textElement/>				<textFieldExpression class="java.lang.String"><![CDATA[$F{country_code}]]></textFieldExpression>			</textField>			<textField>				<reportElement x="532" y="0" width="69" height="20"/>				<textElement/>				<textFieldExpression class="java.lang.Long"><![CDATA[$F{requests}]]></textFieldExpression>			</textField>			<textField>				<reportElement x="601" y="0" width="47" height="20"/>				<textElement/>				<textFieldExpression class="java.lang.Long"><![CDATA[$F{fills}]]></textFieldExpression>			</textField>			<textField>				<reportElement x="648" y="0" width="89" height="20"/>				<textElement/>				<textFieldExpression class="java.lang.Long"><![CDATA[$F{impressions}]]></textFieldExpression>			</textField>			<textField>				<reportElement x="737" y="0" width="59" height="20"/>				<textElement/>				<textFieldExpression class="java.lang.Long"><![CDATA[$F{p_micro_rev}]]></textFieldExpression>			</textField>		</band>	</detail>	<columnFooter>		<band splitType="Stretch"/>	</columnFooter>	<pageFooter>		<band height="22" splitType="Stretch">			<textField>				<reportElement x="676" y="2" width="80" height="20"/>				<textElement textAlignment="Right"/>				<textFieldExpression class="java.lang.String"><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>			</textField>			<textField evaluationTime="Report">				<reportElement x="756" y="2" width="40" height="20"/>				<textElement/>				<textFieldExpression class="java.lang.String"><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>			</textField>		</band>	</pageFooter>	<summary>		<band height="45" splitType="Stretch"/>	</summary></jasperReport>
Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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...