We wants to use case statament like word case setting in jasper report. We have some sentences in our DB is uppercase and we want to change first character is upper and the other one is lowercase. How can we do it in jasper reports?
Thank you.
We wants to use case statament like word case setting in jasper report. We have some sentences in our DB is uppercase and we want to change first character is upper and the other one is lowercase. How can we do it in jasper reports?
Thank you.
On the Jasper report designer;
$F{some_field}.substring(0,1).toUpperCase()+$F{some_field}.substring(1,$F{some_field}.length()).toLowerCase()
For instance: the username's first letter is converted to uppercaps on the below expression. For your case it will be sentence
When you design the report you put references to database fields somewhere on the page. When you open that for editing (right-click -> edit expression
in iReport) what you really write is Java code returning a String, and reference like $F{SOMETHING}
is a String type variable. Nothing prevents you from putting in some logic, like:
$F{SOMETHING}.startsWith("A") ? "cool" : "not cool"