Changes

Format an iReport Template

1,217 bytes added, 00:38, 22 September 2013
Conditional Display
==Conditional Display==
Sometimes it is important to change the display of some data extracted from IMSMA for the resulting report. For example, you want to change:* Null checksthe value “null” to “no”* the value “Male” to “Men”To do this, you use conditional statements in the element on the iReport.
# Select the desired in the iReport template ('''note:''' this is '''NOT''' the field value, but rather the text element on the report displaying the field value)
# On the '''Properties''' pane select the '''Text Expression''' and open the '''Text Expression Editor''''.
#: [[Image:IReport Charts5.png|center|500px|''Text Expression Editor'']]<div align="center">''Text Expression Editor''</div>
# To change the way a particular field is displayed you can use basic "ïf-then-else" logic as in other [[Summarize i-Report Template Data#Variable Expressions|Variable Expressions]]. This follows the pattern:
$F{field} == null ? “Something" : $F{field}
 
Or nested:
$F{field} == null ? “Something" : $F{field} == “SomethingElse” ? “Something Else“ : $F{field}
 
{{note| The type of field is important (string, float, double, int, date). Stick with strings if you can.}}
 
Example:
$F{blockWater} == null ? “No value" : $F{blockWater}
==Adding Formatting Elements==
319
edits