Jump to content

Jaspersoft Studio: thoughts on how to return the number of days between a specified date and today's date?


Scene

Recommended Posts

I am attempting to add an expression to a report which will display the number of days between a date returned in a field on the report, and today's date.

I've worked out the following based on my (incredibly) limited knowledge:

DAYS($F{ADD_DATE},CAST(getDate() AS DATE));

Notes:

-ADD_DATE is the field in question

-DAYS is a native studio function to display the difference in days between two dates

-I am using getDate() to return today's date/time

-I added the CAST function to remove the timestamp from getDate() (I assume this is a requirement of the DAYS function).

 

Due to some limitations the only way for me to test to see if this works is to upload the report to a test server; which requires enlisting the help of our single engineer who is already spread pretty thin, so I don't really have a convenient way to test this on the fly.

If it's not already apparent: I barely have a grasp on basic SQL commands, 0 experience with javascript or other languages, but have at least figured out how to use the expression editor and sorta-kinda leverage some of the native functionality.

Any thoughts you can add to my approach would be incredibly helpful, even basic things that may seem obvious to an educated user or someone more familiar with SQL.

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

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...