Hello everyone. I'm a newbie to iReport. I am trying to write the conditional query into the report.
I had created the following parameters:
$P{queryControl} <String>
${date} <Date>
${deptName} <String>
The parameter called $P{queryControl}, the prompt is turned off as I am setting the value at runtime checking the value of the $P{sex}.
Also, the ${date}, ${deptName} turn on the prompt.
Set the default value of the parameter as:
$P{sex}.equals("F")
? "Select * from employees e, department d where e.staff_no = d.staff_no and department_name = '"+${deptName}+"' and join_date >= ${date}"
: "Select * from employees e, department d where e.staff_no = d.staff_no and department_name = '"+${deptName}+"' and join_date <= ${date}"
However, I found that it's not work when I run the report.
When I not use ${date} in where-clause, the report can be opened.
Any solution?
Thanks in advance.