Jump to content
We've recently updated our Privacy Statement, available here ×

Implode/join collection parameter


phillip.sdao
Go to solution Solved by ghudson_1,

Recommended Posts

This seems like it should be real easy, but its causing me problems.

I have a stored procedure it takes a string that is a comma delimited join of a collection. I want to take a collection that is a multi-select, and turn it into a string as my stored procedure parameter. Tried $P{...}.join(","). Tried making a variable thats String.join($P{...},",") and feeding in the variable. 

 

I would use $X{} but it seems like thats only for parameters. Is there some documentation somewhere on the $X{} functions(not sure what to call them)

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Solution

$X syntax for params is described here:

http://community.jaspersoft.com/documentation/jasperreports-server-administration-guide-beta/query-based-input-controls

But that's more appropriate for creating an IN clause in a SQL query.  You need to cast your collection into string that retains the delimited values?  parameters can be based upon values of other parameters.  Sounds like you need to investigate a java method like this org.springframework.util.StringUtils.collectionToDelimitedString($P{mycollection},",")    <-- that could be the expression of the parameter which you pass to the storedproc

 

 

 

 

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