vaskon Posted October 9, 2015 Share Posted October 9, 2015 Hi i use jaspersoft studio for designing reports. i use a json file as datasourceinside the json file i have sub objects like:{ "vendId": "Vend1", "addressList": [ { "Id": 1030, "ZIPCODE": "BH21 6SP"}, { "Id": 1031, "ZIPCODE": "ABCD"}]}If i put a textbox for the vendId it gets presented correctlybut if i put a field for the addressList.Id then in the preview i see this ["1030","1031"]instead of10301031 what am i dont wrong?how can i show all fields of an inner list of a json file (iterate)is there something like foreach loop that i can do and the same band is redrawn for each addressList?thanks Link to comment Share on other sites More sharing options...
ekoelln Posted November 10, 2016 Share Posted November 10, 2016 I know, this is an old post. Anyway, I hope this can helps anyone:Add a subreport (or a List) component.To add an subreport do:<parameter name="addressList_ID" class="java.lang.String" isForPrompting="false"> // the same parameter name here<subreport> <reportElement x="0" y="20" width="380" height="20" uuid="21333b85-40c8-4ef8-8181-0e62dc3c969d"/> <subreportParameter name="addressList_ID"> // and here <subreportParameterExpression><![CDATA[$F{id}]]></subreportParameterExpression> </subreportParameter> <dataSourceExpression> <![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("addressList")]]> </dataSourceExpression> <subreportExpression><![CDATA[$P{REPORT_DIR} + "subReportName.jasper"]]></subreportExpression></subreport>In subreport, create and add the correspondents fileds to the detail band, etc. 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