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

How do I display nested lists within a parent group into a table?


flupper1990

Recommended Posts

I have a dataset similar to the one below, but with vastly more fields and information. If I were to want to display all of the following. How do I go about it?

If I ignore the EAN-list I can easily display my data within a table by grouping by a field in Packlist_detail. However whenever I create a second grouping for EAN's and place a table within a table, I seem to get an error stating:

"Reset group "EAN" not found for variable: Group2_COUNT ..."

{  "PACKLIST_DETAIL" : [{    "data1" : "1",    "data2" : "2",    "data3" : "3",    "EAN" : [{      "code" : "code1"    },    {      "code" : "code2"    },    {      "code" : "code3"    }]  },  {    "data1" : "1",    "data2" : "2",    "data3" : "3",    "EAN" : [{      "code" : "code1"    },    {      "code" : "code2"    },    {      "code" : "code3"    }]  }]}[/code]

 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Define your subDataset and use it in datasetRun of table.

    <subDataset name="Packlist_detail" uuid="bc2619a3-a304-4ce0-b488-b8ed5c8c9dbc">        <queryString>            <![CDATA[]]>        </queryString>        <field name="data1" class="java.lang.String"/>        <field name="data2" class="java.lang.String"/>        <field name="data3" class="java.lang.String"/>        <field name="EAN" class="java.util.List"/>    </subDataset>[/code]

And in your table:

<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">   <datasetRun subDataset="Packlist_detail" uuid="3abab8d1-8df5-45f3-b2fa-84543646af58">       <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{yourPacklistParam})]]></dataSourceExpression>   </datasetRun>   ...</jr:table>[/code]

And if you want to use EAN in your table, just define another subDataset and then use that subDataset to display.

    <subDataset name="listEAN" uuid="bc2619a3-a304-4ce0-b488-b8ed5c8c9dbc">        <queryString>            <![CDATA[]]>        </queryString>        <field name="code" class="java.lang.String"/>    </subDataset>[/code]

 

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