![](/img/trans.png)
[英]Working with SVG FILES in iReport gives JRExpressionEvalException: Error evaluating expression : Source Text
[英]iReport Error evaluating expression
我們正在使用iReport 5.0.1,並且已經成功轉換了許多Crystal Reports程序包。
我正在使用混合使用整數和雙精度數據類型的數據,並且在詳細信息部分的變量字段內執行計算。
然后,我有3個變量來匯總詳細數據。 第一個變量是其上方的細節變量的直接和。 第二個參數根據IF..THEN..ELSE語句添加一個參數或第二個參數,第三個參數基於類似的IF..THEN..ELSE語句減去非常相同的參數值。
我需要舍入組頁腳中的3個變量字段,因此我將Math.round(variable_name)應用於3個變量中的每個變量。 原始的和最后一個(減去參數)都可以正常工作。 中間變量(添加參數)將引發錯誤“計算表達式時出錯:Math.round(variable_name)”。 如果我刪除格式,它運行正常。
我已經復制並粘貼了工作變量,將其重命名為正確的名稱,以確保我不會像最初設置它們那樣丟失任何東西,但沒有用。 當我使用Empty Datasource運行它時,它將運行,但是當然沒有數據。
這會讓我相信數據有問題,但是我已經對其進行了全面檢查,並且數據對於數據源都是有效的,沒有NULL,空白或字符數據。
在這一點上我很沮喪。 使用幾乎相同的功能,該報表可以在Crystal Reports中編譯並正常運行。
如果有人有任何建議,我很樂意傾聽,並且在下面發布了該報告的XML。
預先感謝您提供的任何幫助。
斯奈德
<?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="MarginRequirement" language="groovy" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="70f7c2ab-dba2-420a-98b9- dc041beb65a7">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="ireport.jasperserver.reportUnit" value="/reports/Risk_Management/MarginRequirement"/>
<property name="ireport.jasperserver.url" value="http://reports.beefnw.com/jasperserver/services/repository"/>
<parameter name="LCF" class="java.lang.Float">
<defaultValueExpression><![CDATA[0.0]]></defaultValueExpression>
</parameter>
<parameter name="LCO" class="java.lang.Float">
<defaultValueExpression><![CDATA[0.0]]></defaultValueExpression>
</parameter>
<parameter name="FCF" class="java.lang.Float">
<defaultValueExpression><![CDATA[0.00]]></defaultValueExpression>
</parameter>
<parameter name="FCO" class="java.lang.Float">
<defaultValueExpression><![CDATA[0.0]]></defaultValueExpression>
</parameter>
<parameter name="GF" class="java.lang.Float">
<defaultValueExpression><![CDATA[0.0]]></defaultValueExpression>
</parameter>
<parameter name="GO" class="java.lang.Float">
<defaultValueExpression><![CDATA[0.0]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[select *,
if (mid(symbol,-3,1) in("F", "G", "H", "J", "K", "M", "N", "Q", "U", "V", "X", "Z"), "Future", "Option") AS type from margin_requirements
order by location, clearing_house
]]>
</queryString>
<field name="open_price" class="java.lang.Float">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="equity" class="java.lang.Float">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="close_price" class="java.lang.Float">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="open_total_value" class="java.lang.Float">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="close_total_value" class="java.lang.Float">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="liquidating_value" class="java.lang.Float">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="commission" class="java.lang.Float">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="account_id" class="java.lang.Integer">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="position_id" class="java.lang.Integer">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="id" class="java.lang.Integer">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="contract_weight" class="java.lang.Integer">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="contracts" class="java.lang.Integer">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="account_name" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="account_number" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="location" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="clearing_house" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="type" class="java.lang.String"/>
<field name="group" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="symbol" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="fill_date" class="java.sql.Date">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="updated_at" class="java.sql.Timestamp">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="created_at" class="java.sql.Timestamp">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<variable name="loc_clHouse" class="java.lang.String" resetType="None">
<variableExpression><![CDATA[$F{location} + " - " + $F{clearing_house}]]></variableExpression>
</variable>
<variable name="LC_Orig" class="java.lang.Float" resetType="None">
<variableExpression><![CDATA[$F{group}=="LIVE_CATTLE"?((($F{contracts}*$F{contract_weight}*$F{open_price})/100)*-1) + (($F{contracts}*$F{contract_weight}*$F{close_price})/100):0.0]]></variableExpression>
</variable>
<variable name="LCOrig_Total" class="java.lang.Float" resetType="Group" resetGroup="ClearingHouse" calculation="Sum">
<variableExpression><![CDATA[Math.round($V{LC_Orig})]]></variableExpression>
</variable>
<variable name="Suppression" class="java.lang.String" resetType="None">
<variableExpression><![CDATA["NO"]]></variableExpression>
</variable>
<variable name="LCUpPrice" class="java.lang.Float" resetType="None">
<variableExpression><![CDATA[$F{type}=="Future"?$F{close_price}+$P{LCF}:$F{close_price}+$P{LCO}]]></variableExpression>
</variable>
<variable name="LCDownPrice" class="java.lang.Float" resetType="None">
<variableExpression><![CDATA[$F{type}=="Future"?$F{close_price}-$P{LCF}:$P{LCO} > $F{close_price}?0.0:$F{close_price}-$P{LCO}]]></variableExpression>
</variable>
<variable name="LC_Decrease" class="java.lang.Float" resetType="None">
<variableExpression><![CDATA[$F{group}=="LIVE_CATTLE"?((($F{contracts}*$F{contract_weight}*$F{open_price})/100)*-1)+(($F{contracts}*$F{contract_weight}*$V{LCDownPrice})/100):0.0]]></variableExpression>
</variable>
<variable name="LCDecr_Total" class="java.lang.Float" resetType="Group" resetGroup="ClearingHouse" calculation="Sum">
<variableExpression><![CDATA[Math.round($V{LC_Decrease})]]></variableExpression>
</variable>
<variable name="LCIncr_Total" class="java.lang.Float" resetType="Group" resetGroup="ClearingHouse" calculation="Sum">
<variableExpression><![CDATA[Math.round($V{LC_Increase})]]></variableExpression>
</variable>
<variable name="LC_Increase" class="java.lang.Float" resetType="None">
<variableExpression><![CDATA[$F{group}=="LIVE_CATTLE"?((($F{contracts}*$F{contract_weight}*$F{open_price})/100)*-1)+(($F{contracts}*$F{contract_weight}*$V{LCUpPrice})/100):0.0]]></variableExpression>
</variable>
<group name="ClearingHouse">
<groupExpression><![CDATA[$V{loc_clHouse}]]></groupExpression>
<groupHeader>
<band height="25">
<printWhenExpression><![CDATA[$V{Suppression}=="YES"]]></printWhenExpression>
<textField>
<reportElement uuid="51b78c4d-3747-4282-8b9f-17be6f84feea" x="0" y="0" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$V{loc_clHouse}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="ad970881-452b-42aa-bb9f-a19e735643c5" x="179" y="5" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$V{Suppression}]]></textFieldExpression>
</textField>
</band>
</groupHeader>
<groupFooter>
<band height="116">
<textField>
<reportElement uuid="79587964-7211-4761-9221-0c063a1aebf0" x="0" y="0" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$V{loc_clHouse}]]></textFieldExpression>
</textField>
<textField pattern="¤ #,##0.00">
<reportElement uuid="3bd9ce71-5cf4-4ae3-b678-8f3942fc9e7a" x="100" y="0" width="100" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{LCOrig_Total}]]></textFieldExpression>
</textField>
<textField pattern="¤ #,##0.00">
<reportElement uuid="20ef4729-88b0-4ab2-a5a6-56594bb716d5" x="100" y="40" width="100" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{LCDecr_Total}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="16a8b6f9-5e24-4ee6-9e84-e2730d78dea1" x="100" y="20" width="100" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{LCIncr_Total}]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch"/>
</title>
<pageHeader>
<band height="142" splitType="Stretch">
<image>
<reportElement uuid="eef5e5ab-7b5d-4f86-a20f-5dd51bbd56bd" x="5" y="4" width="310" height="93"/>
<imageExpression><![CDATA["/home/marlin/bnw_logo_trans.gif"]]></imageExpression>
</image>
<rectangle>
<reportElement uuid="957ac037-7238-46e1-809c-4ded5f76b72b" x="0" y="102" width="572" height="38" forecolor="#E6D8AB" backcolor="#E6D8AB"/>
</rectangle>
<staticText>
<reportElement uuid="3b2925af-f556-4c0c-84bb-e5b5b021128e" x="126" y="110" width="341" height="30"/>
<textElement textAlignment="Center">
<font size="18" isBold="true"/>
</textElement>
<text><![CDATA[MARGIN REQUIREMENT REPORT]]></text>
</staticText>
</band>
</pageHeader>
<columnHeader>
<band height="27" splitType="Stretch">
<rectangle>
<reportElement uuid="a2f2bf6a-6f14-48e5-9d19-5f153caed5a5" x="0" y="0" width="572" height="27" forecolor="#E6D8AB" backcolor="#E6D8AB"/>
</rectangle>
</band>
</columnHeader>
<detail>
<band height="96" splitType="Stretch">
<printWhenExpression><![CDATA[$V{Suppression}=="NO"]]></printWhenExpression>
<textField>
<reportElement uuid="ed06c6f7-7b44-4033-8c4a-9364d9c22e13" x="100" y="0" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$V{LC_Orig}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="55b4791f-dfe7-415c-89d5-ebd937c6a329" x="0" y="0" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$V{Suppression}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="aba93e69-1ab0-476a-81e0-c65d8f482233" x="100" y="40" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$V{LC_Decrease}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="6f9026a6-abf5-4017-974c-9e972bed8181" x="0" y="20" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$P{LCF}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="ff53c29d-4006-4b99-8b77-295717483c79" x="0" y="40" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$P{LCO}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="e305cdbe-e93c-47bb-aedd-f2fc1478e33d" x="100" y="20" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$V{LC_Increase}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
感謝iReport / Jasper論壇提供的答案:
http://community.jaspersoft.com/questions/803533/ireport-error-evaluating-expression#comment-802119
斯奈德
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.