Jump to content

Recommended Posts

Posted

 Hi All

 

I have a report that processes a list of pojos just fine. Within the report, I have created a sub-report to display a List of InputStreams as images.

 

Within the main report, I have defined the sub-report Data Source Expression as follows:

 

new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource([$F{myArrayListOfInputStreams}])

 

myArrayListOfInputStreams is a property of the pojo, and is of type java.util.ArrayList<java.io.InputStream>

 

So far i have tried defining a Field named _THIS of type java.util.List in the sub-report. If I add an Image to the the sub-report Detail band, set the Image Expression to "$F{_THIS}.get(0)", and the Expression class to java.io.InputStream, I can get only one image to display properly.

This is not desired, because I want to display all images in the list. Any ideas how to get the subreport to display all images in the list? I am not sure how to define the fields or what is required in the detail band to accomplish this.

Any help much appreciated.

Thanks.

 

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

Answered my own question:

 

 

In the subreport report element Data Source Expression:

 

new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource([$F{myArrayListOfInputStreams}])

 

Needed to remove the square brackets so it reads:

 

new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{myArrayListOfInputStreams})

 

Defined a field _THIS of type java.io.InputStream. Referenced $F{_THIS} in the detail band, and made sure it was of type java.io.InputStream.

 

Works great.

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