Jump to content
We've recently updated our Privacy Statement, available here ×

Input Date +Days does not work in new JasperServer version


cs_9

Recommended Posts

Hi,

since updating to a new jasper version (docker: bitnami/jasperreports:7-debian-10) several Reports are not working any more.
The Problem seems, that the following instruction (+90) is not being parsed properly any more:

<parameter name="to" class="java.util.Date"><defaultValueExpression><![CDATA[($P{to} == null ? new Date() + 90 : $P{to})]]></defaultValueExpression></parameter>[/code]


I am pretty new to jasperreports. I have tried several possible solutions with no success. Here a few error Messages i got:

ERROR GenericExceptionMapper,http-nio-8080-exec-3:69 - Unexpected error occurs net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ($P{to} == null ? new Date().plusDays(90) : $P{to})ERROR GenericExceptionMapper,http-nio-8080-exec-5:69 - Unexpected error occurs net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ($P{to} == null ? new Date() + 90.days : $P{to})ERROR GenericExceptionMapper,http-nio-8080-exec-1:69 - Unexpected error occurs net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ($P{to} == null ? new Date().set(year, month, date +90, hrs, min, sec) : $P{to})ERROR GenericExceptionMapper,http-nio-8080-exec-6:69 - Unexpected error occurs net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ($P{to} == null ? new Date().add(0,0,90,0,0,0) : $P{to})ERROR GenericExceptionMapper,http-nio-8080-exec-10:69 - Unexpected error occurs net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ($P{to} == null ? new Date().add(Calendar.DATE, 90) : $P{to})ERROR GenericExceptionMapper,http-nio-8080-exec-8:69 - Unexpected error occurs net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ($P{to} == null ? new Date(Instant.now().plus(90,ChronoUnit.DAYS)) : $P{to})ERROR GenericExceptionMapper,http-nio-8080-exec-9:69 - Unexpected error occurs net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ($P{to} == null ? new Date().addDays(5) : $P{to})[/code]

I would appreciate if someone could help me how to fix the "+ 90" (days) issue, to make my report work again with the new jasperserver version.

Thanks in advance!

Link to comment
Share on other sites

  • Replies 9
  • Created
  • Last Reply

Top Posters In This Topic

Thank you for your help Mariano.

Sadly i am very new to jasperserver and jasperstudio.

As is understand it, it should automatically be able to parse groovy and javascript. (There is a related issue https://community.jaspersoft.com/jasperreports-server/issues/12581)

I do not know where i would set groovy language at Report Unit.

May you be so kind to elaborate.

Thanks in advance.

Link to comment
Share on other sites

I cant seem to find it. I use Jaspersoft Studio 6.14.0. When I open the properties for the report unit I get this window:bildschirmfoto_2020-10-02_um_12_52_19.png.e3472976d38e70058f9d855e2dc462cd.png
i can switch to here (so it seems to be the "report unit" which you are talking about):
bildschirmfoto_2020-10-02_um_12_52_11.png.72c31655ac1eb9fd38771ffd6aa01dc8.png
the only place where i can find "language" is here in the query and it does not offer "groovy":
bildschirmfoto_2020-10-02_um_12_53_32.png.e3b2900136c3b2e8b5fd0cf012f0b2f4.png
also in the expression editor when i open the window to the deprecated (backwards compatibility) window, there seems to be a "groovy evaluator" active:bildschirmfoto_2020-10-02_um_13_04_16.thumb.png.f73b33add587c5d4fc5913073c257142.png

Link to comment
Share on other sites

I'm sorry I don't catch on quicker.

I don't know how to open it any other way than i already did.

I can run the report unit or select properties in which case i get the window already shown above
bildschirmfoto_2020-10-02_um_15_48_09.png.5c0e666fbd98da8c035cbdae0ba2787a.png

there is no help topic "report unit":
bildschirmfoto_2020-10-02_um_15_47_29.png.33f2134f7801444034c928566450b156.png
can you maybe point me to any applying documentation, to help me out on "how to open a report unit in jasperstudio"? Thanks!

PS: I do know how to open the report to edit. There is Design, Source and Preview tab. But that can't be what you mean...

Link to comment
Share on other sites

Hey, i finally managed to get the properties window you were talking about...
What information i was missing is... i had to click in the design view into the background of the form for the said properties window to show.bildschirmfoto_2020-10-07_um_13_37_41.png.64d2a01d6e39d62573e0cbe0649c4770.png

I found out, it is already set to groovy. So what else may be the problem here? 

Link to comment
Share on other sites

  • 4 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...