iReport: Group Hiding and Displaying

To hide group depending on field value,

you can do this by setting Print when expression property of particular Group band.

for ex:

Print when expression: ($F{my_field_codice} != null) ? Boolean.TRUE : Boolean.FALSE

above statement hides the group when you got the value null for $F{my_field_codice}.

else it displays the group.


iReport: Applying Condition depending on the parameter value passed

i had the problem


i want to keep the where condition depending on the value of parameter is pass.

i tried different things, and final got through with following solution.

select * from deptartment


(CASE WHEN $P{param_dept_codice} = -1

THEN true

ELSE dept_codice = $P{param_dept_codice}


above query displays all the records from deptartment table, if you pass the param_dept_codice as -1 .

if you pass some exact deptartment id other than -1, then it will return only those records that satisfies the condition.

Note: i gave -1 for checking because i m sure that i will not have any record with that dept_codice.

iReport: Date field without time

when we retrive fields of table from database,

for the Date field in database, it will consider java.util.Date in ireport.

and displaying of Date will be somewhat like

“2009-05-29 00:00:00”

if you dont want to display “hour,minute and seconds”,

then change the Expression Class property to java.lang.String.

after that it will display