ward.vantichelen Posted March 31, 2014 Share Posted March 31, 2014 I have created a MyCustomDataSource that implements the JRDataSource interface. This data source will call a webservice to retreive the data. The end user must be able to enter some parameters. In the report designer in JasperSoft Studio I've created the parameter with a name MYPARAMETER1 and MYPARAMETER2 as an example.These parameters must be passed to the webservice call.Do do this I've implemented a myCustomDataSourceProvider that implements the JRDataSourceProvider interface. With this I can pass the JasperReport to the MyCustomerDataSource.@Overridepublic JRDataSource create(JasperReport arg0) throws JRException { return new MyCustomDataSource(arg0);} Inside the constructor of MyCustomDataSource I try to read out the values of the entered parameters, but I am unable to do that. public MyCustomDataSource(JasperReport jrreport){ String myParameter1Value = ""; //Retrieving the array of parameters: JRParameter[] params = jrreport.getParameters(); for(JRParameter param : params) { if(param.getName().equals("MYPARAMETER1")) { //here I can retreive a lot of information of the parameter, but not the actual entered value: String description = param.getDescription();//works fine String defaultValue = param.getDefaultValueExpression();//works fine (and I can use this for hidden parameters) //the following statement does not work (does not even compile), but I actually need something like this //myParameter1Value = param.getValue(); } }} So my question is: how can I retreive the value of an entered parameter in my customer data source? This seems to be a very straightforward functionality and I've seen several similar posts like this, but none of them were answered. Link to comment Share on other sites More sharing options...
hozawa Posted April 1, 2014 Share Posted April 1, 2014 Following wiki page may provide you with information.http://community.jaspersoft.com/wiki/adding-filter-custom-datasource 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