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

Report Parameter Getting Report Name's Value?


Recommended Posts

By: mike w - mwans

Report Parameter Getting Report Name's Value?

2003-11-17 15:29

I have a report that uses multiple groups to print each page. For example, Group1 prints page 1, Group2 prints page 2. This works fine until I try to use it with a recordset with more than one value. Somehow, one of my parameters is getting the name of the report as it's value. Here's the error I am getting:

 

dori.jasper.engine.JRException: Incompatible value assigned to parameter pMonth : STATEWIDE_FBI_HARDCOPY

 

===========================

 

Here is the top of my 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="STATEWIDE_FBI_HARDCOPY"

columnCount="1"

printOrder="Vertical"

orientation="Portrait"

pageWidth="700"

pageHeight="1020"

columnWidth="650"

columnSpacing="0"

leftMargin="25"

rightMargin="25"

topMargin="20"

bottomMargin="20"

whenNoDataType="AllSectionsNoDetail"

isTitleNewPage="false"

isSummaryNewPage="false">

 

<parameter name="pAgencyName" class="java.lang.String" />

<parameter name="pAgencyCode" class="java.lang.String" />

<parameter name="pMonth" class="java.lang.String" />

<parameter name="pYear" class="java.lang.String" />

<parameter name="pCounty" class="java.lang.String" />

<parameter name="pWarPath" class="java.lang.String" />

 

<parameter name="monthExpression" class="java.lang.String">

<defaultValueExpression><![CDATA[($P{pMonth}==null || $P{pMonth}.trim().equals("")?"":" AND MONTH = " + $P{pMonth} + " ")]]></defaultValueExpression>

</parameter>

 

<parameter name="yearExpression" class="java.lang.String">

<defaultValueExpression><![CDATA[" WHERE YEAR = " + $P{pYear} + " "]]></defaultValueExpression>

</parameter>

 

<parameter name="agencyCodeExpression" class="java.lang.String">

<defaultValueExpression><![CDATA[($P{pAgencyCode}==null || $P{pAgencyCode}.trim().equals("")?"":" AND AGENCY_CODE = '" + $P{pAgencyCode} + "' ")]]></defaultValueExpression>

</parameter>

 

<parameter name="countyExpression" class="java.lang.String">

<defaultValueExpression><![CDATA[($P{pCounty}==null || $P{pCounty}.trim().equals("")?"":" AND COUNTY_NAME = '" + $P{pCounty} + "' ")]]></defaultValueExpression>

</parameter>

 

<parameter name="theQuery" class="java.lang.String">

<defaultValueExpression><![CDATA["SELECT NCIC_AGENCY_CODE, AGENCY_NAME, COUNTY_NAME, MONTH, YEAR FROM RETURNA, VW_AGENCY_COUNTY " + $P{yearExpression} + $P{monthExpression} + $P{agencyCodeExpression} + $P{countyExpression} + " AND NCIC_AGENCY_CODE = AGENCY_CODE ORDER BY NCIC_AGENCY_CODE, YEAR, MONTH"]]></defaultValueExpression>

</parameter>

 

<queryString>$P!{theQuery}</queryString>

 

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

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

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

<field name="MONTH" class="java.lang.Long"/>

<field name="YEAR" class="java.lang.Long"/>

.

.

.

Groups Here

.

.

.

Sumary, etc...

==========================

 

Here is the JAVA calling the Report:

 

private class StatewideFBIReportCommand extends WebCommandAdapter

{

public String execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, WebValidationException

{

try

{

ServletContext _context = getServletConfig().getServletContext();

HttpSession _session = request.getSession();

UserContext _userContext = UserSystem.instance().getCurrentUserContext(_session);

DOJUser _theUser = (DOJUser)_userContext.getUser();

 

Map _parameters = new HashMap();

String _agencyName = Agency.getAgencyNameForCode(request.getParameter("ncicAgencyCode"));

 

_parameters.put("pAgencyName", (_agencyName != null && !(_agencyName.equals("null")) ? _agencyName : null));

_parameters.put("pAgencyCode", (_theUser.getRole().canDo(DOJPermission.ANY_AGENCY_REPORTS) ? (request.getParameter("ncicAgencyCode") != null && !request.getParameter("ncicAgencyCode").equals("null") ? request.getParameter("ncicAgencyCode") : null) : _theUser.getNcicAgencyCode()));

_parameters.put("pMonth", (request.getParameter("pMonth") == null || request.getParameter("pMonth").trim().length() < 1 ? null : request.getParameter("pMonth")));

_parameters.put("pYear", (request.getParameter("pYear") == null || request.getParameter("pYear").trim().length() < 1 ? null : request.getParameter("pYear")));

_parameters.put("pCounty", (request.getParameter("pCounty") == null || request.getParameter("pCounty").trim().length() < 1 ? null : request.getParameter("pCounty")));

 

File _reportFile = new File(_context.getRealPath("/reports/Statewide_FBI_Hardcopy.jasper"));

 

redirectToReport(_parameters, _reportFile, response);

 

return null;

}

catch (Exception _e)

{

Logger.instance().debug("Exception in Statewide FBI Report: " + _e, _e);

request.setAttribute("message", "Exception in Statewide FBI Report. See Administrator for details.");

return "ecp_ccmessage.jsp";

}

}

}

 

==========================

 

Can anyone see how I would get this error? Please Help.

 

Thank You,

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