date parameter in ireport

I want to filter data for a specific period. I defined two date parameters like $P{FromDate} and $P{ToDate}; but , when I run the report, I get all records without any filtering. this is my sql in the report-
select * from customer where trunc(createdate) between to_date($P{FromDate},'dd-mm-yyyy') and to_Date($P{ToDate},'dd-mm-yyyy').
I also tried like this
select * from customer where trunc(createdate)>= to_date($P{FromDate},'dd-mm-yyyy') and trunc(createdate)<=to_Date($P{ToDate},'dd-mm-yyyy').

I am using Oracle database and using Oracle datasource connection in the report.This sql runs perfectly in toad and returns the filtered resultset.

If I hardcode a value for the date instead of using parameter the report returns the filtered data.

If any one can help, please.
nyttle's picture
Joined: Oct 25 2006 - 5:55pm
Last seen: 16 years 11 months ago

Yeah i had this problem but couldnt find a way around it


danielscherczer - 8 years 3 months ago

1 Answer:

There is a attribute on the parameter definition in JRXML with a name like promptFor...

If you set it, iReport will prompt you to fill the parameter in before the report is run.

swood's picture
Joined: Jun 21 2006 - 12:48pm
Last seen: 10 years 11 months ago