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

Hyperlink Collections that contain commas in the items [solved]


rault

Recommended Posts

As of Jasper 4.2...when you hyperlink a collection it gets turned into a string, added to the querystring for the second report then the parameter in the second report (of the same name) picks up the value and converts it to a collection object. This works great when your data doesn't contain commas like so:

http://server/jasperserver-pro/myreportid?direction=[North, South, East, West]

What if "North" wasn't North but "No,rth", then the querystring looks like:

http://server/jasperserver-pro/myreportid?direction=[No,rth, South, East, West]

The Collection in the second report will not contain 4 items but 5 because of the comma delimiter in North. This is problematic behavior when your Collection is associated with a multiselect input control in the second report like mine was. After finding nothing in Java or Groovy to help, I finally ran accross a method in the Spring framework:

org.springframework.util.StringUtils.collectionToDelimitedString($P{MyCollection}, "#")

You can use this to turn the collection into a string in the first report, then use Collection.join(string myCollection, string delimiter) to convert it back in the second report.

Just posting this here incase anyone else was banging their head like I was...

--Robert

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

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