Jump to content
JasperReports Library 7.0 is now available ×

setting values from Map(java) in Parameters


meetjeetendra

Recommended Posts

Hi I am facing one problem.

I am creating a pdf using I-reports through java.

I used the following code.

Code:

jasperPrint=JasperFillManager.fillReport(jasperReport,mymap,connection);

Here mymap contains request time parameters(Date1,Date2) which i will be using in my select query to fetch those records which lies between Date1 and Date2.

My question is how to create parameters in I-reports and retrieve values from Date1 and Date2.

And how to set this retrieved values in my select query.

 

Please, can any one help me on this.

 

thanks in advance.

Ji2...

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

In your report, right click in the document structure window and click add then parameters. Name the parameters as you wish and set their class type to be java.util.Date.

 

These will now be filled when you call jasperprint.

 

Your query can access them by using, for example,

 

WHERE table.datefield BETWEEN $P{date1} and $P{date2}

 

if your parameters were named 'date1' and 'date2'.

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