Show report parameter value to user from database


How can I show the report parameter's value to user from database before selection.

Suppose user have to select Organization id which is a Text value but yet he had not informed which Org_ID 's are available to Database Table.

I want to show those ID's from database table to help him to select according to his desire.
Suppose by pressing F2 key he will see all abailable ID's.

How can I achive this.

I want to draw attention specially JasperSoft to help.

alauddinctgbd's picture
Joined: Aug 4 2006 - 8:37pm
Last seen: 17 years 1 month ago

1 Answer:

you can do it but you will not like my solution, since it's messy

It can be done by injecting some JSP to the

so you insert the following code in to main.jsp

<%@page import="java.sql.Connection"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.SQLException"%>
<%@page import="java.sql.* "%>

Connection myConn = DriverManager.getConnection("jdbc:mysql://host/test?user=user&password=pass");
Statement stmt = myConn.createStatement();
ResultSet myResultSet =
stmt.executeQuery("select Id, Name
from SomeTable ;");
if (myResultSet != null) {
int i = 0;
while ( {
String db_name = myResultSet.getString("Name");
String db_id = myResultSet.getString("Id");
%> <div> <a href="javascript:setNameId('<%= db_name%>','<%= db_id%>');"> -<%= oname%> </a> </div> <%
myConn.close(); %>

now you have list of names that link to the appropriate field setters ....
implement the setNameId, which set values to the input controlles you defined in report
function setSiteAndOperator(site_text, operator_text) {

hide the widget if we have no input control variable
if ( document.getElementById("input_name") == null ) {
document.getElementById("widget_menu").style.visibility = "hidden";
sofra's picture
Joined: Jul 19 2006 - 3:29am
Last seen: 17 years 2 months ago