我收到错误“在此上下文中不支持表单的表达式列表(a; b; c)”在编译报表时,删除了一些字段并添加了一些新字段。这可以防止编译报告。
我正在使用iReport 5.1.0。
完整错误如下:
编译异常:com.jaspersoft.ireport.designer.compiler.ErrorsCollector@19c51d5 net.sf.jasperreports.engine.JRException:编译报表表达式类文件时遇到错误:org.codehaus.groovy.control.MultipleCompilationErrorsException:startup失败:calculator_Events_1383802163165_797769:325:此上下文中不支持表单(a; b; c)的表达式列表。 at line:325 column:21。file:calculator_Events_1383802163165_797769 @ line 325,column 21.在net.sf.jasperreports.engine.design的net.sf.jasperreports.compilers.JRGroovyCompiler.compileUnits(JRGroovyCompiler.java:113)发生错误。 JRAbstractCompiler.compileReport(JRAbstractCompiler.java:201)at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:240)at net.sf.jasperreports.engine.JasperCompileManager.compileToFile(JasperCompileManager.java:156)at net .sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:439)at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:528)org.openide.util.RequestProcessor $ Task.run (RequestProcessor.java:572)org.openide.util.RequestProcessor $ Processor.run(RequestProcessor.java:997)引起:org.codehaus.groovy.control.MultipleCompilationErrorsException:startup failed ed:calculator_Events_1383802163165_797769:325:表单的表达式列表(a; b; C)在这种情况下,不支持。在行:325列:21。文件:calculator_Events_1383802163165_797769 @第325行,第21行。在org.codehaus.groovy.control.CompilationUnit的org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:302)发生错误。 applyOoSourceUnits(CompilationUnit.java:915)org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:564)org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:540)org.codehaus .groovy.control.CompilationUnit.compile(CompilationUnit.java:517)at net.sf.jasperreports.compilers.JRGroovyCompiler.compileUnits(JRGroovyCompiler.java:109)... 7更多
根据要求,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="Events" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="81b33856-d23f-41e3-99a1-9ec1f42e7781">
<property name="ireport.zoom" value="1.6105100000000008"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<style name="Title" fontName="Arial" fontSize="40" isBold="true" pdfFontName="Times-Bold"/>
<style name="Column Heading" forecolor="#736343" fontName="Arial" fontSize="14" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
<style name="Field Label" forecolor="#666666" fontName="Arial" fontSize="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
<style name="Detail" fill="Solid" fontName="Arial" fontSize="12" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
<style name="Row" mode="Transparent" fontName="Arial">
<conditionalStyle>
<conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression>
<style backcolor="#E6DAC3"/>
</conditionalStyle>
</style>
<field name="id" class="java.lang.Integer"/>
<field name="timedateStart" class="java.util.Date"/>
<field name="timedateEnd" class="java.util.Date"/>
<field name="timedateReported" class="java.util.Date"/>
<field name="areaStart" class="java.lang.String"/>
<field name="areaEnd" class="java.lang.String"/>
<field name="login" class="java.lang.String"/>
<field name="state" class="java.lang.String"/>
<field name="summary" class="java.lang.String"/>
<field name="details" class="java.lang.String"/>
<field name="tripInvolvement" class="java.lang.String"/>
<field name="tripName" class="java.lang.String"/>
<field name="itsrClass" class="java.lang.String"/>
<field name="closeoutComments" class="java.lang.String"/>
<field name="tripDate" class="java.lang.String"/>
<field name="tripFrom" class="java.lang.String"/>
<field name="tripTo" class="java.lang.String"/>
<field name="tripDelay" class="java.lang.String"/>
<field name="code" class="java.lang.String"/>
<field name="eventNumber" class="java.lang.String"/>
<field name="tripOperator" class="java.lang.String"/>
<field name="safetyComments" class="java.lang.String"/>
<group name="ID" keepTogether="true">
<groupExpression><![CDATA[$F{id}]]></groupExpression>
<groupHeader>
<band height="101">
<textField pattern="dd MMM yy HH:mm">
<reportElement uuid="ccf2faf4-1ebc-4833-bffb-be793843bfbb" style="Detail" x="89" y="29" width="95" height="18"/>
<textElement>
<paragraph leftIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{timedateStart}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="bc927ec0-afbe-4acb-a2dd-30ed83bf87ca" style="Field Label" x="0" y="29" width="89" height="18"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Start Time:]]></text>
</staticText>
<textField pattern="dd MMM yy HH:mm" isBlankWhenNull="true">
<reportElement uuid="ca7ec72f-66dc-48ee-a3ba-1a8ad24e5151" style="Detail" x="273" y="29" width="100" height="18"/>
<textElement>
<paragraph leftIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{timedateEnd}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="e4b8515a-e1f4-46a2-b539-609918c274e8" style="Field Label" x="184" y="29" width="89" height="18"/>
<textElement textAlignment="Right"/>
<text><![CDATA[End Time:]]></text>
</staticText>
<textField>
<reportElement uuid="b77e01cd-299d-4de2-8087-c2a39dfad2c1" style="Detail" x="273" y="11" width="100" height="18"/>
<textElement>
<paragraph leftIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{areaStart}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="8c7e8a18-8bc1-4458-a8ba-b08289f93d1f" style="Field Label" x="184" y="11" width="89" height="18"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Start Location:]]></text>
</staticText>
<textField>
<reportElement uuid="f70f1a2a-c8b9-49b8-b89c-e316c0f3d5a9" style="Detail" x="651" y="11" width="151" height="18"/>
<textElement>
<paragraph leftIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{login}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="f66e357d-4951-4bbb-8c5a-7ef6620f2146" style="Field Label" x="562" y="11" width="89" height="18"/>
<textElement textAlignment="Right"/>
<text><![CDATA[User:]]></text>
</staticText>
<textField>
<reportElement uuid="62f6ee8e-2f53-4790-abc8-3eb18e0fc373" style="Detail" x="462" y="11" width="100" height="18"/>
<textElement>
<paragraph leftIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{areaEnd}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="608c4c23-f157-4e67-8e3e-2d5e61b973da" style="Field Label" x="373" y="11" width="89" height="18"/>
<textElement textAlignment="Right"/>
<text><![CDATA[End Location:]]></text>
</staticText>
<textField isBlankWhenNull="true">
<reportElement uuid="4e78d65d-579f-46d6-88a9-d32ad8c65603" style="Detail" x="651" y="29" width="151" height="18"/>
<textElement>
<paragraph leftIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{state}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="df4c04ba-02b1-4a5a-85fe-73d696ed4baf" style="Field Label" x="562" y="29" width="89" height="18"/>
<textElement textAlignment="Right"/>
<text><![CDATA[State:]]></text>
</staticText>
<textField>
<reportElement uuid="5116325d-bfec-4937-a839-fcaf57ac91f3" style="Detail" x="89" y="65" width="714" height="18"/>
<textElement>
<paragraph leftIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{summary}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="b98c7a80-a12c-4868-8e02-e075a156b085" style="Field Label" x="0" y="65" width="89" height="18"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Title:]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement uuid="8e708653-5838-4046-a081-92035aa855fe" style="Detail" stretchType="RelativeToBandHeight" x="89" y="83" width="714" height="18"/>
<textElement>
<paragraph leftIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{details}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="adc7448c-13a8-4911-b7b6-74e7b9261d7e" style="Field Label" x="0" y="83" width="89" height="18"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Details:]]></text>
</staticText>
<textField pattern="dd MMM yy HH:mm" isBlankWhenNull="true">
<reportElement uuid="aa3bc766-6000-47f2-8e65-da927940c456" style="Detail" x="462" y="29" width="100" height="18"/>
<textElement>
<paragraph leftIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{timedateReported}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="72920f21-de19-4494-bbe9-38ae43e263a2" style="Field Label" x="373" y="29" width="89" height="18"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Report Time:]]></text>
</staticText>
<line>
<reportElement uuid="13211da9-beb1-415c-ac7f-5389686ef661" x="0" y="5" width="802" height="1"/>
<graphicElement>
<pen lineWidth="5.75" lineStyle="Double"/>
</graphicElement>
</line>
<staticText>
<reportElement uuid="ad7bdabe-7f4b-4b72-b99d-6fe18afac7c0" style="Field Label" x="0" y="11" width="89" height="18"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Event Number:]]></text>
</staticText>
<textField>
<reportElement uuid="2148ce11-9119-48e8-8c91-002a7107fbcb" style="Detail" x="89" y="11" width="95" height="18"/>
<textElement>
<paragraph leftIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{eventNumber}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="39bff358-7af5-4752-bfc4-f803bfadab40" style="Field Label" x="0" y="47" width="89" height="18">
<printWhenExpression><![CDATA[$F{code} != null]]></printWhenExpression>
</reportElement>
<textElement textAlignment="Right"/>
<text><![CDATA[Code:]]></text>
</staticText>
<textField isBlankWhenNull="true">
<reportElement uuid="9730d29d-873b-4d29-b028-48404027e19b" style="Detail" x="89" y="47" width="95" height="18">
<printWhenExpression><![CDATA[$F{code} != null]]></printWhenExpression>
</reportElement>
<textElement>
<paragraph leftIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{code}]]></textFieldExpression>
</textField>
</band>
</groupHeader>
<groupFooter>
<band height="64">
<printWhenExpression><![CDATA[$F{itsrClass} != null]]></printWhenExpression>
<staticText>
<reportElement uuid="10f8cca4-d383-4ba1-9cf4-8795b1b0dd98" style="Field Label" isPrintRepeatedValues="false" x="1" y="6" width="183" height="20" printWhenGroupChanges="ID"/>
<textElement>
<font size="15"/>
</textElement>
<text><![CDATA[Categorisation]]></text>
</staticText>
<staticText>
<reportElement uuid="cfaee340-8abf-4197-8c08-10b10ef66dcf" style="Field Label" isPrintRepeatedValues="false" x="1" y="26" width="115" height="18" printWhenGroupChanges="ID"/>
<textElement textAlignment="Right"/>
<text><![CDATA[ITSR Classification:]]></text>
</staticText>
<staticText>
<reportElement uuid="78403c7e-1d15-4eea-aeca-cc401fbad57a" style="Field Label" isPrintRepeatedValues="false" x="1" y="44" width="115" height="18" printWhenGroupChanges="ID"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Safety Comments:]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement uuid="b1edd0e3-7c49-4838-8fc8-6d699873ba85" style="Detail" stretchType="RelativeToBandHeight" isPrintRepeatedValues="false" x="117" y="26" width="684" height="18"/>
<textElement>
<paragraph leftIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{itsrClass}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement uuid="b6973a40-0464-410a-9fa5-b3b814e36a31" style="Detail" stretchType="RelativeToBandHeight" isPrintRepeatedValues="false" x="117" y="44" width="684" height="18"/>
<textElement>
<paragraph leftIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{safetyComments}]]></textFieldExpression>
</textField>
<line>
<reportElement uuid="5a3a0871-0b2b-4b8d-945b-755259a29f38" x="0" y="3" width="802" height="1"/>
</line>
</band>
<band height="20">
<printWhenExpression><![CDATA[$F{closeoutComments} != null]]></printWhenExpression>
<staticText>
<reportElement uuid="23b26dc6-d74b-45f5-b4f6-c91ca98613b0" style="Field Label" isPrintRepeatedValues="false" x="1" y="0" width="115" height="18" printWhenGroupChanges="ID"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Closeout:]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement uuid="91479638-455b-4e46-a6f4-b3dd9d4dc2a8" style="Detail" stretchType="RelativeToBandHeight" isPrintRepeatedValues="false" x="117" y="0" width="684" height="18"/>
<textElement>
<paragraph leftIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{closeoutComments}]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
<group name="Trip">
<groupExpression><![CDATA[$F{tripInvolvement}]]></groupExpression>
<groupHeader>
<band height="20">
<printWhenExpression><![CDATA[$F{tripInvolvement} != null]]></printWhenExpression>
<staticText>
<reportElement uuid="1edf4f6a-4acb-4f8f-ac70-f1a3c754567e" style="Field Label" x="89" y="2" width="89" height="18"/>
<textElement/>
<text><![CDATA[Train]]></text>
</staticText>
<staticText>
<reportElement uuid="1f5c9a4e-c5bf-4d27-9f0c-21a42a65ecef" style="Field Label" x="178" y="2" width="100" height="18"/>
<textElement/>
<text><![CDATA[Date]]></text>
</staticText>
<staticText>
<reportElement uuid="1a8a189c-a27e-4ca5-b148-11ed220b2584" style="Field Label" x="515" y="2" width="89" height="18"/>
<textElement/>
<text><![CDATA[From]]></text>
</staticText>
<staticText>
<reportElement uuid="48030e71-fe77-4c61-a106-018c90e536a6" style="Field Label" x="603" y="2" width="100" height="18"/>
<textElement/>
<text><![CDATA[To]]></text>
</staticText>
<staticText>
<reportElement uuid="9c3b0468-afb7-4d7a-be92-db117bc397b2" style="Field Label" x="702" y="2" width="89" height="18"/>
<textElement/>
<text><![CDATA[Delay]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement uuid="f4afaf65-7726-4f41-9959-ab9ac23e38a5" style="Detail" stretchType="RelativeToBandHeight" x="0" y="2" width="89" height="18"/>
<textElement textAlignment="Left"/>
<textFieldExpression><![CDATA[$F{tripInvolvement} != null ? ( $F{tripInvolvement}.equals( "primary" ) ? "Primary" : "Reactionary" ) : null]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="7017fd47-578c-4e81-b10f-e2958e53acd8" style="Field Label" x="277" y="2" width="239" height="18"/>
<textElement/>
<text><![CDATA[Operator]]></text>
</staticText>
<line>
<reportElement uuid="fa1ceb36-94f4-4663-a93d-238d17090a6c" x="1" y="0" width="801" height="1"/>
</line>
</band>
</groupHeader>
<groupFooter>
<band/>
</groupFooter>
</group>
<group name="ID Group Footer Response">
<groupExpression><![CDATA[$F{id}]]></groupExpression>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band splitType="Stretch"/>
</title>
<pageHeader>
<band height="62" splitType="Stretch">
<image isUsingCache="true">
<reportElement uuid="1da1169f-b408-446a-bb59-54c6c8fd916b" x="0" y="0" width="222" height="60"/>
<imageExpression><![CDATA["client_logo.png"]]></imageExpression>
</image>
<staticText>
<reportElement uuid="80d953b0-4a59-4da5-8a65-b837b70c5f00" style="Title" x="184" y="0" width="618" height="60"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font pdfFontName="Times-Roman"/>
</textElement>
<text><![CDATA[Event Report]]></text>
</staticText>
</band>
</pageHeader>
<columnHeader>
<band height="1" splitType="Stretch">
<line>
<reportElement uuid="65b62c3c-1b80-498e-94d5-892b9c188550" positionType="FixRelativeToBottom" x="0" y="0" width="802" height="1"/>
<graphicElement>
<pen lineWidth="0.5" lineColor="#999999"/>
</graphicElement>
</line>
</band>
</columnHeader>
<detail>
<band height="19" splitType="Stretch">
<textField pattern="dd MMM yy HH:mm" isBlankWhenNull="true">
<reportElement uuid="d2773154-ce1e-4234-bfd3-c7230b1e1cbe" style="Detail" x="89" y="0" width="89" height="18">
<printWhenExpression><![CDATA[$F{tripName} != null;]]></printWhenExpression>
</reportElement>
<textElement/>
<textFieldExpression><![CDATA[$F{tripName}]]></textFieldExpression>
</textField>
<textField pattern="dd MMM yy HH:mm" isBlankWhenNull="true">
<reportElement uuid="a577c389-9b30-439e-bb16-119f8221c87d" style="Detail" x="178" y="0" width="100" height="18">
<printWhenExpression><![CDATA[$F{tripDate} != null;]]></printWhenExpression>
</reportElement>
<textElement/>
<textFieldExpression><![CDATA[$F{tripDate}]]></textFieldExpression>
</textField>
<textField pattern="dd MMM yy HH:mm" isBlankWhenNull="true">
<reportElement uuid="134f90c3-b3b3-4007-8040-c91db462be10" style="Detail" x="515" y="0" width="89" height="18">
<printWhenExpression><![CDATA[$F{tripFrom} != null;]]></printWhenExpression>
</reportElement>
<textElement/>
<textFieldExpression><![CDATA[$F{tripFrom}]]></textFieldExpression>
</textField>
<textField pattern="dd MMM yy HH:mm" isBlankWhenNull="true">
<reportElement uuid="b3648125-f342-4539-ac36-22cfa152c92d" style="Detail" x="603" y="0" width="100" height="18">
<printWhenExpression><![CDATA[$F{tripTo} != null;]]></printWhenExpression>
</reportElement>
<textElement/>
<textFieldExpression><![CDATA[$F{tripTo}]]></textFieldExpression>
</textField>
<textField pattern="dd MMM yy HH:mm" isBlankWhenNull="true">
<reportElement uuid="536f9148-1de2-428b-aa8a-9bdb4488cba3" style="Detail" x="702" y="0" width="89" height="18">
<printWhenExpression><![CDATA[$F{tripDelay} != null]]></printWhenExpression>
</reportElement>
<textElement/>
<textFieldExpression><![CDATA[$F{tripDelay}]]></textFieldExpression>
</textField>
<textField pattern="dd MMM yy HH:mm" isBlankWhenNull="true">
<reportElement uuid="b138c7d9-c31c-4c9d-b004-d343ac194448" style="Detail" x="277" y="0" width="239" height="18">
<printWhenExpression><![CDATA[$F{tripFrom} != null;]]></printWhenExpression>
</reportElement>
<textElement/>
<textFieldExpression><![CDATA[$F{tripOperator}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="24" splitType="Stretch">
<frame>
<reportElement uuid="e73fa5db-7501-44f9-b061-ba0179add4cd" mode="Opaque" x="0" y="0" width="802" height="24" forecolor="#D0B48E" backcolor="#F2EBDF"/>
<textField evaluationTime="Report">
<reportElement uuid="d32aa440-7736-464d-b9ca-4b5ff2c86929" style="Field Label" x="762" y="0" width="40" height="24" forecolor="#736343"/>
<textElement verticalAlignment="Middle">
<font size="10" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="590794dc-150e-4555-941c-6e9742bc4fd2" style="Field Label" x="682" y="0" width="80" height="24" forecolor="#736343"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="10" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
</textField>
<textField pattern="EEEEE dd MMMMM yyyy">
<reportElement uuid="4ab75820-1c6a-49de-b76c-272860dc4f7c" style="Field Label" x="0" y="0" width="197" height="24" forecolor="#736343"/>
<textElement verticalAlignment="Middle">
<font size="10" isBold="false"/>
<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
<image hAlign="Center">
<reportElement uuid="8dd54fe0-9404-400c-879f-8e5b56d9d839" x="355" y="0" width="96" height="24"/>
<imageExpression><![CDATA["4tel_logo.png"]]></imageExpression>
</image>
</frame>
</band>
</pageFooter>
<summary>
<band splitType="Stretch"/>
</summary>
</jasperReport>
答案 0 :(得分:2)
您正在使用$F{tripFrom} != null;
- &gt; groovy中不允许;
没有这样的用法
从您的所有expression
和printwhenexpression
或
将您的报告语言从groovy更改为java
它对我有用