Jump to content
Changes to the Jaspersoft community edition download ×

Only Hidden Parameter on Input-Control page


Recommended Posts



I have a single Input-Control and that is a hidden parameter. Actually this parameter is getting populated on this very page and I necessarily need it in my report. Thus, I end up with a Parameter page with "Run Report", "Cancel" an "Save Values" button.


I want the control to come to the DefaultParametersForm.jsp, check if there are only Hidden Parameters, if so proceed to run the report without waiting for the user to press the "Run Report".


Any suggestion is welcome.




Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Thanks Lucian for your prompt response.


What i meant was this:


We have a particular ID associated with each user. The data to be displayed in the report is dependent on this ID i.e. we have to add it in the where condition, something like:


where user_id = 'xyz'.


The value 'xyz' in the above example is the ID associated with the user. I thought it best to pass it as a hidden parameter. For this I have written some java code (jdbc query) on DefaultParametersForm.jsp itself. The code snippet is given below:


Connection con = DriverManager.getConnection("jdbc:oracle:thin:@grendel.sftech.corp.biz:1521:TQA","im1","ecl1ps3");

Statement stmt = con.createStatement();

ResultSet rs = stmt.executeQuery("select urol_tbd_id,urol_cmp_id from sv_user_role where urol_usr_id=(select usr_id from sv_tb_user where usr_login_name='"+username+"')");


tbdId = rs.getString("urol_tbd_id");


This variable tbdId is passed to a hidden prompt named tbdIdParam as follows:


<c:if test="${inputName == 'tbdIdParam'}"> <input type="hidden" name="${inputName}" id="${inputName}" value="<%=tbdId%>"/> </c:if>


My problem is:


1) When I do not have any other prompt to be input by user, I end up with a blank prompt page, as this particular prompt is hidden but required across all users and all reports.


2) And second, but a more fundamental one, the whole approach taken is not an elegant way to implement this functionality.


Any suggestion/ help will be highly appreciated.



Kumar Rahul.

Link to comment
Share on other sites

The scenario of only having a single hidden input control is not currently supported by JasperServer. You can log a bug for this here, and we will investigate it.


An alternative solution for your requirement is to write a method in a helper class that fetches the required data from DB, and use this method in the parameter's default value expression.


It's not clear where "username" comes from in your example, but if it's the user currently logged in JasperServer, you would have something like this:


<!-- JRXML -->
<parameter name="LoggedInUser" class="com.jaspersoft.jasperserver.api.metadata.user.domain.User"/>
<parameter name="tbdIdParam" isForPrompting="false">


If your reports have SQL query, you could also pass $P{REPORT_CONNECTION} to the method so that you don't need to obtain a new connection.




Link to comment
Share on other sites

Thanks a lot, Lucian.


The alternate solution suggested is something I was looking forward to. Will surely give it a try.


The "userName" is not the user currently logged in JasperServer but another userName related to each user.


I tried logging the bug at the given link but did not find an available option to log one.




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