alauddinctgbd Posted November 2, 2006 Share Posted November 2, 2006 Hi, 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. Alauddin Link to comment Share on other sites More sharing options...
sofra Posted November 2, 2006 Share Posted November 2, 2006 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 jasperintelligence-1.1.0/apache-tomcat/webapps/jasperserver/WEB-INF/decorators/main.jsp 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.* "%> <% Class.forName("com.mysql.jdbc.Driver"); 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 (myResultSet.next()) { String db_name = myResultSet.getString("Name"); String db_id = myResultSet.getString("Id"); %> <div> <a href="javascript:setNameId('<%= db_name%>','<%= db_id%>');"> -<%= oname%> </a> </div> <% }}stmt.close();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----------------------------------------------------<script> function setSiteAndOperator(site_text, operator_text) { document.getElementById("input_name").value=text; document.getElementById("input_id").value=text; }</script>------------------------------------------------------ hide the widget if we have no input control variable-------------------------------------------------------<script> if ( document.getElementById("input_name") == null ) { document.getElementById("widget_menu").style.visibility = "hidden"; } </script>------------------------------------------------------- Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now