How to pass items form a webpage to a report

Jaspersoft Community 'Read-Only' as of July 8, 2022

Transition to New TIBCO Community Just Weeks Away

You can still search, review wiki content, and review discussions in read-only mode. Please email community@tibco.com with questions or issues requiring TIBCO review or response.

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
433
Joined: Mar 15 2013 - 12:17pm
Last seen: 3 years 5 months ago

1 Answer:

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
12102
Joined: Sep 13 2011 - 8:04am
Last seen: 3 years 9 months ago
Feedback