I’m trying to execute a jrxml template generated with DynamicJaper. This template was created with a report which contains a CustomExpression and when I try to execute de jrxml throught DynamicJasper classes I obtain this excepción
net.sf.jasperreports.engine.JRException: Unknown column name : customExpression_for_5
at net.sf.jasperreports.engine.JRResultSetDataSource.getColumnIndex(JRResultSetDataSource.java:355)
at net.sf.jasperreports.engine.JRResultSetDataSource.getFieldValue(JRResultSetDataSource.java:112)
at net.sf.jasperreports.engine.fill.JRFillDataset.setOldValues(JRFillDataset.java:823)
at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:787)
In the JRXML file appears parameters and report elements with the name "customExpression_for_5" which seems to be the cause of the exception. You can read fragments of my jrxml file below this lines.
<parameter name="customExpression_for_5" class="ar.com.fdvs.dj.domain.CustomExpression"/>
<parameter name="customExpression_for_5_calc" class="ar.com.fdvs.dj.domain.CustomExpression"/>
<queryString>
<![CDATA[SELECT * FROM ( SELECT TABLA2.S_F AS "5",TABLA2.S_A AS "9" FROM TABLA2 WHERE (TABLA2.S_F=$P{param0}) )]]>
</queryString>
<textField isStretchWithOverflow="true" pattern="dd-MM-yyyy" isBlankWhenNull="true">
<reportElement style="Verdana_for_column_5_" positionType="Float" x="0" y="0" width="181" height="15" isPrintWhenDetailOverflows="true"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[((ar.com.fdvs.dj.domain.CustomExpression)$P{REPORT_PARAMETERS_MAP}.get("customExpression_for_5")).evaluate( ((ar.com.fdvs.dj.core.DJDefaultScriptlet)$P{REPORT_SCRIPTLET}).getCurrentFiels(), ((ar.com.fdvs.dj.core.DJDefaultScriptlet)$P{REPORT_SCRIPTLET}).getCurrentVariables(), ((ar.com.fdvs.dj.core.DJDefaultScriptlet)$P{REPORT_SCRIPTLET}).getCurrentParams() )]]></textFieldExpression>
</textField>
JDK versión 1.5
DynamicJasper versión 3.1.5 (also tested in 3.1.8)
JasperReports versión 3.7.2