Jump to content
Changes to the Jaspersoft community edition download ×

How to set default values for report parameters ?


shiv_4
Go to solution Solved by reportdev,

Recommended Posts

I have a report that has two parameters, Start Date and End Date. I need to set default values for Start Date to be the first day of the year and end date to be today's date. How can I set these values ? There are user expressions but how can I specify custom expression ?

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Solution

Here you go:

<parameter name="startDate" class="java.util.Date">
        <defaultValueExpression><![CDATA[DATE(YEAR(new Date()),01,01)]]></defaultValueExpression>
    </parameter>
    <parameter name="endDate" class="java.util.Date">
        <defaultValueExpression><![CDATA[new Date()]]></defaultValueExpression>
    </parameter>

 

startDate Expression: DATE(YEAR(new Date()),01,01)

endDate Expression: new Date()

Link to comment
Share on other sites

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