0
如何在另一個文本字段中使用文本字段表達式的結果?在另一個字段中使用表達式值
我有以下表達式文本框:
($P{currency}.equals("EUR"))
? $F{documentPeriodsRate}
: $P{currency}.equals("USD") && $F{documentHeadDocClass}.equals("1")
? $F{documentPeriodsRate}/$F{foreignCurrencyUSDBid}
: $P{currency}.equals("USD") && $F{documentHeadDocClass}.equals("2")
? $F{documentPeriodsRate}/$F{foreignCurrencyUSDAsk}
: $P{currency}.equals("GBP") && $F{documentHeadDocClass}.equals("1")
? $F{documentPeriodsRate}/$F{foreignCurrencyGBPBid}
: $P{currency}.equals("GBP") && $F{documentHeadDocClass}.equals("2")
? $F{documentPeriodsRate}/$F{foreignCurrencyGBPAsk}
: $P{currency}.equals("CHF") && $F{documentHeadDocClass}.equals("1")
? $F{documentPeriodsRate}/$F{foreignCurrencyCHFBid}
: $P{currency}.equals("CHF") && $F{documentHeadDocClass}.equals("2")
? $F{documentPeriodsRate}/$F{foreignCurrencyCHFAsk}
: $P{currency}.equals("YEN") && $F{documentHeadDocClass}.equals("1")
? $F{documentPeriodsRate}/$F{foreignCurrencyJPYBid}
: $P{currency}.equals("YEN") && $F{documentHeadDocClass}.equals("2")
? $F{documentPeriodsRate}/$F{foreignCurrencyJPYAsk}
: ""
我需要從用於計算另一文本框上面的表達式的結果。我試圖把一個變量$V{euroCalc}
上述表達式和替換變量$V{euroCalc}
上述文本框的表情,但我下面的錯誤:
Error filling print... Error evaluating expression :
Source text : $V{euroCalc}
Setting up the file resolver...
net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
Source text : $V{euroCalc}
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:203)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:591)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:559)
at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:884)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:421)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:406)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:257)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:457)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2037)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:771)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:281)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:144)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:909)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:822)
at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:61)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:446)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:276)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:745)
at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:891)
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: java.lang.Double cannot be cast to java.lang.String
at boss_charterfaktura_document_list_interval_positions_1392719953257_176604.evaluate(boss_charterfaktura_document_list_interval_positions_1392719953257_176604:307)
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:190) ... 20 more
Print not filled. Try to use an EmptyDataSource...
什麼是使用表達式值的其它計算的正確方法?