Set Additional Parameter Values in JRXML File based on Primary Input

0

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!

brian.berrelez's picture
Joined: May 9 2017 - 7:31am
Last seen: 1 year 7 months ago

2 Answers:

0

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

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

It works now!!!

brian.berrelez's picture
Joined: May 9 2017 - 7:31am
Last seen: 1 year 7 months ago
0

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.

Friendly User's picture
Joined: Oct 8 2009 - 5:59am
Last seen: 1 week 5 hours ago
Feedback
randomness