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

How to pass items form a webpage to a report


jkeri

Recommended Posts

My Jasper reports are launched from a java webpage that has multiple items on it. I want to select multiple items from the webpage and pass all of them into my Jasper report. My report has a simple SQL query

SELECT SAMPLENUMBER from SAMPLE_TABLE

WHERE SAMPLENUMBER in the list of samples i checked off on the webpage.

Can anyone help me with the coding that need to be in the SQL query and any other tips on this?

Thanks in advance.

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

To do this you will need to use a parameter in your report. And since you want to use the 'IN' statment in your query; your report parameter has to be defined as a collection and you will use the $X{IN, , } expresion in your query. So if you named your parameter 'MYSELECTEDNUMBERS', your report query will look like:

SELECT SAMPLENUMBER from SAMPLE_TABLE
WHERE $X{IN, SAMPLENUMBER, MYSELECTEDNUMBERS}

You will find more information in Chapter 6 of the iReport ultimate guide (http://community.jaspersoft.com/documentation) and also here: http://jasperreports.sourceforge.net/sample.reference/query/index.html 

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