Parameter allowing user to select multiple Dates to Filter on

0

Hi,

I am trying to create a report that returns the number of records based on a date field. I would like allow the user to select specific dates for the report to filter on. For example, when the user runs this report, a calender would pop up to allow the user to select multiple dates and the report would only brings back records where the date matches dates selected. Is this possible? Thanks.  

nguy0861's picture
Joined: Jun 26 2013 - 2:35pm
Last seen: 3 years 4 months ago

2 Answers:

1

Hello,

Yes this is possible, you will want to implemnt the whole calandar popup in your java enviromnet. But in order to set a date you would work into the sql statement said query and set it to a paramater. This pramater is one  you create in iReport. below is an example.

Java Side:

Stirng startDate = " ";

String endDate = " ";

Date date = new dateFormat("your fromat");

Map pram = new HashMap();

paramater.put("Start", startDate);

paramater.put("End", endDate);

SQL:

select

your table with the date

from

your table

where

your table = $P{START_DATE}

your table = $P{END_DATE}

iReport:

Report Inspector --> paramater --> add a new on and call it start date and end date

Place them in the template.

This is of course very rough outline however the basic flow is like so.

Enjoy!

 

Java_Jasper's picture
Joined: Jan 17 2012 - 10:13am
Last seen: 3 years 8 months ago

Hi...Thank you for your response.
I am looking to accomplish something slightly different. I am having to build a report that looks at data for a date range like the solution you mentioned above but with additional criteria.
Selecting a Date range of data. Within that population of data, I need to count the number of records around 1st, 15th, and 25th.
If any data that has a date on either 1st, 15th, and 25th that falls on weekends or holidays, then also include the data for the weekend and for the next business day. For example, if I have 2 records that falls on the 1st and that happens to be on a saturday. The total count would be 2 records on saturday + # of records on sunday + records on monday. If monday happens to fall on a holiday, then count tuesday and so on. Instead of building the logic to count these records, I'd like to build a paramatized report that allows the user to select the date they want to include on the report.

nguy0861 - 5 years 9 months ago

Ok, I see what you are asking for now.

In sql you can use a "Between" to put the desired range into the paramaters you want and then do this for each date selected.

yourTable.tableName $P{startDate} AND $P{endDate} AND

If you are trying only to get data of the 1st, 15, and 25th you will need to decide on how to make a range. In the example above it would be startDate == 1st and endDate == 25th.

Now if you are trying to trigger records for each date 1st, 15, and 25th the range would be more of a time frame like 24hrs. Keep taking it through though.

Java_Jasper - 5 years 9 months ago
0

Are you using the Jasper Server to generate Report.If you then it is very simple.you can also select by default dates.If user wants to  select dates also possible. 

netti royala's picture
Joined: Oct 28 2013 - 11:43pm
Last seen: 4 years 7 months ago
Feedback
randomness