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

JasperSoft studio json list


vaskon

Recommended Posts

Hi i use jaspersoft studio for designing reports. i use a json file as datasource

inside 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 correctly
but if i put a field for the addressList.Id then in the preview i  see this ["1030","1031"]
instead of
1030
1031
 
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

  • 1 year later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

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