Jump to content
Changes to the Jaspersoft community edition download ×

Set Additional Parameter Values in JRXML File based on Primary Input


brian.berrelez
Go to solution Solved by brian.berrelez,

Recommended Posts

I have a report that runs by month name. Once this date is selected I need to set a specific date range based on the month selection. I've tried using a cascading parameter but I am only to get the first input date to set, not the second one.

So, is it possible to set the parameter values within the JRXML file? Using JAVA and switch method to evaluate the parameter and set the other additional parameters accordingly.

Thanks in advance!

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Unfortunately it's not possible to make one input control to be dependent on another input control like that unless they are query based. Cascading input controls operate in a sense that selection from one input control automatically is passed to the query of a dependent input control. So if your date ranges are returned by a query then it's possible but I doubt they are. You may want to allow users just to enter both and have an auxilliary parameter in the report that has a default value expression based on the other parameter values and do the calculations in that expression.

Link to comment
Share on other sites

  • Solution

Found my problem!

SELECT  CASE $P{Month}   WHEN 1 THEN '2017-11-30'  WHEN 2 THEN '2017-12-31'  WHEN 3 THEN '2017-01-31'  WHEN 4 THEN '2017-02-28'  WHEN 5 THEN '2017-03-31'  WHEN 6 THEN '2017-04-30'  WHEN 7 THEN '2017-05-31'  WHEN 8 THEN '2017-06-30'  WHEN 9 THEN '2017-07-31'  WHEN 10 THEN '2017-08-31'  WHEN 11 THEN '2017-09-30'  WHEN 12 THEN '2017-10-31'  END AS StartDate,CASE MONTH(CURRENT TIMESTAMP)   WHEN 1 THEN '2017-12-30'  WHEN 2 THEN '2017-01-30'  WHEN 3 THEN '2017-02-27'  WHEN 4 THEN '2017-03-30'  WHEN 5 THEN '2017-04-29'  WHEN 6 THEN '2017-05-30'  WHEN 7 THEN '2017-06-29'  WHEN 8 THEN '2017-07-30'  WHEN 9 THEN '2017-08-30'  WHEN 10 THEN '2017-09-29'  WHEN 11 THEN '2017-10-30'  WHEN 12 THEN '2017-11-29'  END AS EndDateFROM core.env[/code]

I wasn't evaluting the Parameter in the second CASE statement.

It works now!!!

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