Jump to content
We've recently updated our Privacy Statement, available here ×

ArrayList Parameter for query


fabridp

Recommended Posts

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Hi There,

 

I'm using a JasperFillManager.fillReport to create the report.  To make this work I am passing in a hashmap.

 

eg.

Create the parameter in iReport or your XML doc (in this case 'ITEM_ID')

Map parameters = new HashMap();
parameters.put('ITEM_ID', '15846');
JasperFillManager.fillReport(jasperReport, parameters, dataSource);

 

When this is done your parameter should be available for use in your query at report launch time.  You can reference it like this...

 

SELECT item, otheritemdetail

FROM items

WHERE id = $!P{ITEM_ID}

 

Be sure to include the '!' in the parameter reference or else it will enclose its value in "".

 

Hope this helps.

 

 

Code:


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