keithrbennett Posted June 11, 2010 Share Posted June 11, 2010 Hi, everyone. I have something like this in the XML file that I'm using as my data source:<reportItems> <reportItem> <fruits> <fruit>apple</fruit> <fruit>orange</fruit> </fruits> </reportItem></reportItems>I'd like to use a Groovy expression to join them into a single string which will be used as the string value of one "Fruits" field:groovy:000> ["apple", "orange"].join(', ')===> apple, orangeThis report (actually a subreport) is listing the reportItem's, so the fruits field would be repeated once per reportItem. Is there any way I can do this? Is there an XPath expression that will return a Java or Groovy array or list? Can a field contain an XPath query as part of its expression? Thanks for any help.- KeithPost Edited by keithrbennett at 06/11/2010 23:06Post Edited by keithrbennett at 06/11/2010 23:07 Link to comment Share on other sites More sharing options...
itchytoes Posted June 14, 2010 Share Posted June 14, 2010 I think I've done stuff like this by passing into a Java scriptlet a Node that starts at the <fruits> level if you can obtain that via an Xpath, then my java scriptlet would put together the string from the <fruit> elements 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