Jump to content
Changes to the Jaspersoft community edition download ×

ArrayList as a parameter within IN query?


philippw

Recommended Posts

Hallo everyone,

we started working with jasperreports and use the jrs-rest-java-client libraries to create our reports. We now stumbled across a problem using an java.util.ArrayList as a parameter within an IN-clause:

select *from tablenamewhere$X{IN, tablename.columnname1, pListParameter}and tablename.columnname2 = $P{pAnotherParameter}[/code]

It works fine with the default expression for the pListParameter in jaspersoft Studio

new ArrayList(Arrays.asList(new String[]{"Smith","Miller","Bush"}[/code]

So the report uses the correct IN-clause and therefore the parameter.

Now when i try to pass an ArrayList in Java (using the above mentioned jrs-rest-java-client library), single parameters get passed fine, but the ArrayList is not working. Part of the java code is:

import com.jaspersoft.jasperserver.dto.common.PatchDescriptor;import com.jaspersoft.jasperserver.dto.resources.ClientReportUnit;import com.jaspersoft.jasperserver.jaxrs.client.core.JasperserverRestClient;import com.jaspersoft.jasperserver.jaxrs.client.core.RestClientConfiguration;import com.jaspersoft.jasperserver.jaxrs.client.core.Session;import com.jaspersoft.jasperserver.jaxrs.client.core.enums.AuthenticationType;import com.jaspersoft.jasperserver.jaxrs.client.core.enums.JRSVersion;import com.jaspersoft.jasperserver.jaxrs.client.core.enums.MimeType;import com.jaspersoft.jasperserver.jaxrs.client.core.operationresult.OperationResult;//code shortened...    private String parametername  = "";       private List<String> parameterMap   = new ArrayList<String>();//code shortened...            System.out.println(parameterMap.toString());//this does print out [smith, Miller, Bush]//reportPath is the URL for the report inside the jasperserver//format is e.g. PDF            OperationResult<InputStream> result = session                    .reportingService()                    .report(reportPath)                    .prepareForRun(format.toUpperCase())                    .parameter(parametername,   parameterMap)                                       .run();[/code]

Does anyone have an idea where to look? Is there a way to log the resulting query string in jasperserver?

Thanks in advance!

Greetings, Philipp

Link to comment
Share on other sites

  • 1 year later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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