maelan.desPrezdelamorlais_ Posted October 19, 2016 Share Posted October 19, 2016 Hello reader,I'm a bit new to jasper and was trying to do something, maybe not allowed.I'm trying to print a report containing a List of ReportData, each ReportData containing some values and a collection of Beans printed in a subreport.So what i wanted to do was putting my ReportData values in Detail Band, then (in detail band) a subreport to print my bean collection (and have it's own page number).Here is a json exemple : [{"FieldA":"Value","FieldB":[{"FieldB1":"Value","FieldB2":"Value","FieldB3":"Value","FieldB4":[{"FieldB4A":"value","FieldB4B":"value","FieldB4C":"value"},{"FieldB4A":"value","FieldB4B":"value","FieldB4C":"value"},{"FieldB4A":"value","FieldB4B":"value","FieldB4C":"value"}]},{"FieldA":"Value","FieldB":[{"FieldB1":"Value","FieldB2":"Value","FieldB3":"Value","FieldB4":[{"FieldB4A":"value","FieldB4B":"value","FieldB4C":"value"},{"FieldB4A":"value","FieldB4B":"value","FieldB4C":"value"},{"FieldB4A":"value","FieldB4B":"value","FieldB4C":"value"}]},{"FieldA":"Value","FieldB":[{"FieldB1":"Value","FieldB2":"Value","FieldB3":"Value","FieldB4":[{"FieldB4A":"value","FieldB4B":"value","FieldB4C":"value"},{"FieldB4A":"value","FieldB4B":"value","FieldB4C":"value"},{"FieldB4A":"value","FieldB4B":"value","FieldB4C":"value"}]}]I tried using "$P{REPORT_DATA_SOURCE}.subDataSource("FieldB4")" with and without cast (net.sf...JSonDataSource) as datasource expression.It did'nt worked.I tried to set my type as collection, list, and so on, to use "new net.sf...JRBeanCollectionDataSource($F{FieldB4})", but i got error saying it failed to read the field and convert it. So, my question is, how should i declare/use my "FieldB" to get a dataSource from it for my subreport, with one occurence of the subReport by occurence of Detail Band?Like That : FieldA : It's Value (the first one)SubReport with first FieldB as dataSource (this subReport has a table wich explain why FieldB4 is a list)Field A : It's Value (the second one)SubReport with second FieldB as dataSourceAnd so on.=====================================================================================================================Up ? - 21/10/2016 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