2012-05-22 103 views
0

表達式時可以在打印中放置多個條件嗎?你可以請給出語法。例如,打印iReport中的表達式時比較2字符串

If Field Value = 'Cancelled' then Print Grey Color 
Feild Value = 'Proposed ' then Print Black Color 

基於字段值,我需要改變文本框的顏色。

我用這句法

$F{status_Current}.StringValue() ='Canceled'? Boolean.TRUE : Boolean.FALSE 

但它拋出一個錯誤。

有人可以請給這個

+1

*** status_Current ***字段的類型是什麼?如果** java.lang.String **,那麼Java 5中的正確語法是:'$ F {status_Current} .equals(「Canceled」)? true:false'。對於Java 4:'$ F {status_Current} .equals(「已取消」)? Boolean.TRUE:Boolean.FALSE' –

回答

0

正確的語法試試這個:

$ F {} status_Current .StringValue()等於( 「取消」)。? Boolean.TRUE:Boolean.FALSE

HTH。

1

假設變量status_Current爲字符串類型的,你應該能夠使用

$F{status_Current}.equals("Canceled")? Boolean.TRUE : Boolean.FALSE 

比較,但它聽起來像你可能會嘗試做一些有條件的格式,我還沒有做呢。 我研究了一下,發現this question希望它有幫助。

祝你好運!

0
  1. 領域 'status_Current' 的類型爲String

$ F {} status_Current .equals( 「取消」)? Boolean.TRUE:Boolean.FALSE

  • 類型字段 'status_Current' 的是NOT字符串
  • $ F {status_Current} .StringValue()。等於(「已取消」)? Boolean.TRUE: Boolean.FALSE