0
(
$P{cal}.clear() ||
$P{cal}.set(Calendar.YEAR, $P{year_current})||
$P{cal}.set(Calendar.WEEK_OF_YEAR, $P{week_current}) ||
$P{cal}.setFirstDayOfWeek(Calendar.MONDAY) ||
$P{cal}.setMinimalDaysInFirstWeek(4)
)
? null : $P{formatter}.format($P{cal}.getTime())

The above code calculates the start date from ‘week_current’ and ‘year_current’ input’s. The problem is that the code calculates the startDate in ireport but not in jasper server.

When I run the report on jasper server, the display mode (pop-up window) comes up blank without any input controls.

But when I change the above code to match one of your date calculations,the same report runs without any issues on jasper server i.e, the display mode (pop-up window) shows the defined input controls.

I would appreciate if you can let me know what is wrong on my date calculation expression which is preventing the input controls to appear on jasper server.

Siva Raparla
  • 104
  • 5
  • Your title mentions Groovy, but your problem description does not. If you change your parameter's default value to use Java (and change the report language to Java) does it work better? – mdahlman Oct 02 '12 at 16:26
  • When I change the report language to java from groovy in the ireport, the report throws an error saying that "the operator || is undefined for the argument type(s) void,void" – Siva Raparla Oct 03 '12 at 13:53
  • Yes, that's not a valid Java expression. But what happens if you change your parameter's default value to use Java? – mdahlman Oct 03 '12 at 18:29
  • can you please explain me in ireport 'how to change the parameter's default value to use Java'? – Siva Raparla Oct 03 '12 at 20:28
  • the above code is in the default value expression of the 'startDate' parameter. – Siva Raparla Oct 03 '12 at 20:32
  • I mean the above code is not a valid Java expression. Does the report work as expected when you use a valid Java expression instead? – mdahlman Oct 03 '12 at 22:37

1 Answers1

-1

I found a solution to the problem, you need to pass the class java.util.Calendar as parameter:

http://type-exit.org/adventures-with-open-source-bi/2010/06/date-calculation-in-ireport/

Petter Friberg
  • 21,252
  • 9
  • 60
  • 109