How to pass items form a webpage to a report

0

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.

jkeri's picture
142
Joined: Mar 15 2013 - 12:17pm
Last seen: 6 months 4 weeks ago

1 Answer:

0

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 

marianol's picture
4545
Joined: Sep 13 2011 - 8:04am
Last seen: 10 months 3 weeks ago
Feedback