Jump to content

iReport - Optional between date parameters


justin.brown11
Go to solution Solved by justin.brown11,

Recommended Posts

Hi all,

I've got a simple SQL query that I'm trying to get optional between date parameters working for. 

At the moment, I've got this working:

SQL-wise it should simply just be:

  1. WHERE START_DATE BETWEEN START_DATE AND END_DATE 

Jaspersoft-wise the input controls need to be optional

  • WHERE (START_DATE >= $P{REPORT_START_DATE} OR $P{REPORT_START_DATE} IS NULL
  • AND START_DATE <=  $P{REPORT_END_DATE} OR $P{REPORT_END_DATE} IS NULL)

Problem is, whilst I'm getting no errors when both the REPORT_START_DATE and REPORT_END_DATE are populated I'm seeing start dates that are greater than the report end date?

Edit: 

Adding AND ($X{BETWEEN, CODE_START_DATE,  $P{1.REPORT_START_DATE}, $P{2.REPORT_END_DATE}}) to the end of the SQL Script gives me an "Unrecognized SQL ecape 'Between'" error. :( 

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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