Today() and ElapsedMinutes() functions don't not return expected values in JasperReports Server 7.9

book

Article ID: 241766

calendar_today

Updated On:

Products

CA Service Desk Manager CA Service Management - Service Desk Manager

Issue/Introduction

We have several adhoc views that use the Today() and ElapsedMinutes() functions to get the tickets assigned to a service in the last 30 minutes. Before the upgrade from 7.2 to 7.9, the Today() function returned the current timestamp. 

However, since we did the update, the Today() function returns today's date with the time 00:00:00 instead of timestamp

 

Environment

Release : 17.3

Component : SDM - Reporting/BOXI/JasperSoft

Resolution

The Today() function is designed to return Date, it does not contain time along with it. so that is why the result calculated is different. one possible way to achieve your requirement is to create a custom function to get the current timestamp and use it in the adhoc custom field to calculate the current timestamp and then use it in elapsed Date function.

To create a custom function please refer to the following article https://community.jaspersoft.com/wiki/creating-now-function-adhoc-domain-allows-you-get-current-timestamp 

The above article will guide you to create a function that will return the current timestamp which will include the current date and time. This new function can be used in a Expression as below :
ElapsedMinutes(NOW(), "creation date")