我想在细节带中显示价值。Oracle DB中数据类型为clob且值包含HTML标记的行
我收到此错误消息:
Error filling print... Error evaluating expression :
Source text : $F{DISCHARGE_TEXT}.getSubString( 1l, ( new Long( $F{DISCHARGE_TEXT}.length() ) ).intValue())
net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
Source text : $F{DISCHARGE_TEXT}.getSubString( 1l, ( new Long( $F{DISCHARGE_TEXT}.length() ) ).intValue())
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:195)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:589)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:557)
at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:929)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:383)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:368)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:258)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:499)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2033)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:760)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:270)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:128)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:946)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:845)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247)
at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:877)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)
Caused by: java.lang.ClassCastException: oracle.sql.CLOB cannot be cast to oracle.sql.CLOB
at testReport_1377507739843_118503.evaluate(testReport_1377507739843_118503:199)
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:182) ... 19 more
Print not filled. Try to use an EmptyDataSource...
我被应用了类似的东西,但未能运行报告
$F{DISCHARGE_TEXT}.getSubString( 1l, ( new Long( $F{DISCHARGE_TEXT}.length() ) ).intValue())
jrxml 是
<?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="report1" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="c9787a67-b067-4421-a7b5-e13d0e6785d8">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<queryString language="SQL">
<![CDATA[select DISCHARGE_TEXT
from ip_discharge
where admission_no='A011303011860']]>
</queryString>
<field name="DISCHARGE_TEXT" class="oracle.sql.CLOB"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch"/>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch">
<staticText>
<reportElement uuid="ac99f9c5-28bf-410d-aee2-8ad5bdb95708" x="293" y="2" width="100" height="20"/>
<textElement/>
<text><![CDATA[DISCHARGE_TEXT]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="125" splitType="Stretch">
<textField>
<reportElement uuid="9d6fdb47-3f70-4620-9cf8-17fcc2be4da8" x="293" y="55" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{DISCHARGE_TEXT}.getSubString( 1l, ( new Long( $F{DISCHARGE_TEXT}.length() ) ).intValue())]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>