Instead of “Cells”, you will be using Fields & Variables in JasperSoft.
Fields are denoted like this: $F{Field Name}
Variables are denoted like this: $V{Variable Name}
In the Expression Editor , simply double-click on the name of a field or variable, and it will automatically create the syntax for you.
Plain Text in Expressions
Plain text in expressions should always be surrounded by double quotes (just like formulas in Excel)
Equations
Equations with Numeric Fields
Use == for numeric fields
Example
Copy $F{Performance Level} == 4
Equations with Text Fields
Use .equals(“ “) for String/Text fields
Example:
Copy ${Performance Level Text}.equals(“Proficient”)
Does Not Equal with Numeric Fields
Use != for numeric fields
Example:
Copy $F{Performance Level} != 4
Does Not Equal with Text Fields
Use !$F{Field Name}.equals(“ “) for String/Text fields
Example:
Copy !F{Performance Level Text.equals(“Proficient”)
Greater/Less Than or Equal To
Do not use "==" for Greater/Less Than or Equal To
Example:
Copy $F{Percent Correct}>=85
Conditional Expressions (i.e. “If, Then” Statements):
Learning how to write an “If Then” expression in JasperSoft studio is an essential building block for creating all sorts of reports. It is very similar to writing “IF()” formulas in Excel, but the syntax is different.
In Excel ...
an IF() formula uses the following syntax:
=IF(Condition, Output if True, Output if False)
Example : =IF(B2>A2,"Growth","Decline”)
In JasperSoft Studio ...
A conditional expression uses the following syntax:
Condition ? Output if True : Output if False
Example 1:
Copy $F{Percent Correct}>=90
? “Mastered”
: “Not Mastered”
Example 2:
Copy $F{Performance Level}.equals("Proficient")
? $F{Student ID}
: null
Example 3 :
Copy $F{2015 CELDT Level}>$F{2014 CELDT Level}
? “Growth”
: “Decline”
Syntax: [Condition] ? [Output if True] : [Output if False]
Nested Conditional Expressions
You can nest conditional expressions to create more complex logic statements.
Example 1:
Copy $F{Percent Correct}>=90 ? “Exceeding Standard”
:$F{Percent Correct}>=80 ? “Meeting Standard”
:$F{Percent Correct}>=70 ? “Approaching Standard”
:$F{Percent Correct}<70 ? “Below Standard”
:“Not Tested”
Note: The conditional expression will stop as soon as a condition is met, only moving on to the next condition if the preceding condition is false .
Example 2:
Copy $F{Grade Level}.equals("1")?
($F{DRABOY}<1?"Benchmark Not Met"
:$F{DRABOY}<=2?"Benchmark Nearly Met"
:$F{DRABOY}<=3?"Benchmark Met"
:$F{DRABOY}>=4?"Benchmark Exceeded"
:"Not Tested")
:$F{Grade Level}.equals("2")?
($F{DRABOY}<=12?"Benchmark Not Met"
:$F{DRABOY}<=14?"Benchmark Nearly Met"
:$F{DRABOY}<=16?"Benchmark Met"
:$F{DRABOY}>=18?"Benchmark Exceeded"
:"Not Tested")
:$F{Grade Level}.equals("3")?
($F{DRABOY}<=20?"Benchmark Not Met"
:$F{DRABOY}<=24?"Benchmark Nearly Met"
:$F{DRABOY}<=28?"Benchmark Met"
:$F{DRABOY}>=30?"Benchmark Exceeded"
:"Not Tested")
:$F{Grade Level}.equals("4")?
($F{DRABOY}<=30?"Benchmark Not Met"
:$F{DRABOY}<=34?"Benchmark Nearly Met"
:$F{DRABOY}<=38?"Benchmark Met"
:$F{DRABOY}>=40?"Benchmark Exceeded"
:"Not Tested")
:$F{Grade Level}.equals("5")?
($F{DRABOY}<38?"Benchmark Not Met"
:$F{DRABOY}==38?"Benchmark Nearly Met"
:$F{DRABOY}<=40?"Benchmark Met"
:$F{DRABOY}>40?"Benchmark Exceeded"
:"Not Tested")
:"Not Tested"
“And” / “Or” Logic
Example:
Copy $F{Grade Level}.equals(“K”) && $F{Scale Score}>=220
Example:
Copy $F{Performance Level}.equals(“Meeting Standard”) || $F{Performance Level}.equals(“Exceeding Standard”)
The “pipe” character (“ | “) key is located above the return/enter key (hold shift)