Search code examples
jasper-reportsxmldatasource

Is using subreports the only solution here?


We are using Jasper Reports to build our reports. There's a report which looks somewhat like this.

Rcpt No | Rcpt Date | Dealer Name | Items | Qty Ordered | Qty Received | Qty Accepted | Qty Rejected
====================================================================================================
1       | 12-08-14  | ABC Corp.   | 

                                  | Item1 | 30          | 30           | 30           | 0
                                  | Item2 | 30          | 30           | 30           | 0
                                  | Item3 | 30          | 30           | 30           | 0
                                  | Item4 | 30          | 30           | 30           | 0
----------------------------------------------------------------------------------------------------
1       | 12-08-14  | ABC Corp.   | 

                                  | Item1 | 30          | 30           | 30           | 0
                                  | Item2 | 30          | 30           | 30           | 0
                                  | Item3 | 30          | 30           | 30           | 0
                                  | Item4 | 30          | 30           | 30           | 0
----------------------------------------------------------------------------------------------------
1       | 12-08-14  | ABC Corp.   | 

                                  | Item1 | 30          | 30           | 30           | 0
                                  | Item2 | 30          | 30           | 30           | 0
                                  | Item3 | 30          | 30           | 30           | 0
                                  | Item4 | 30          | 30           | 30           | 0
----------------------------------------------------------------------------------------------------

We are using xml as the data source for the report. This is the XML:

<?xml version="1.0" encoding="UTF-8"?>
<data>
   <period>
      <fromDate>someFromDate</fromDate>
      <toDate>someToDate greater than fromDate</toDate>
   </period>
   <receiptList>

         <someStoresInwardReceiptNumber>
            <_id>someMongoGivenId</_id>
            <challanNo>someChallanNumber</challanNo>
            <itemList>

                  <item>
                     <_id>someItemId</_id>
                     <description>someDescription</description>
                     <productCatlgNo>someProductCatalogNo</productCatlgNo>
                     <quantityInNumbers>
                        <acceptedQuantity>20</acceptedQuantity>
                        <declaredQuantity>20</declaredQuantity>
                        <receivedQuantity>20</receivedQuantity>
                        <rejectedQuantity>0</rejectedQuantity>
                        <units>pcs</units>
                     </quantityInNumbers>
                     <quantityinWeight>
                        <acceptedWeight>0</acceptedWeight>
                        <declaredWeight>0</declaredWeight>
                        <receivedWeight>0</receivedWeight>
                        <rejectedWeight>0</rejectedWeight>
                        <units null="true" />
                     </quantityinWeight>
                  </item> 
                  <item>
                     <_id>someItemId1</_id>
                     <description>someDescription1</description>
                     <productCatlgNo>someProductCatalogNo1</productCatlgNo>
                     <quantityInNumbers>
                        <acceptedQuantity>0</acceptedQuantity>
                        <declaredQuantity>0</declaredQuantity>
                        <receivedQuantity>0</receivedQuantity>
                        <rejectedQuantity>0</rejectedQuantity>
                        <units null="true" />
                     </quantityInNumbers>
                     <quantityinWeight>
                        <acceptedWeight>300</acceptedWeight>
                        <declaredWeight>300</declaredWeight>
                        <receivedWeight>300</receivedWeight>
                        <rejectedWeight>300</rejectedWeight>
                        <units>kgs</units>
                     </quantityinWeight>
                  </item>

            </itemList>
            <partyName>somePartyName</partyName>
            <receiptDate>someDate</receiptDate>
            <receiptNumber>someStoresInwardReceiptNumber</receiptNumber>
         </someStoresInwardReceiptNumber>

         <someOtherStoresInwardReceiptNumber>
            <_id>someMongoGivenId</_id>
            <challanNo>someChallanNumber</challanNo>
            <itemList>

                  <item>
                     <_id>someItemId</_id>
                     <description>someDescription</description>
                     <productCatlgNo>someProductCatalogNo</productCatlgNo>
                     <quantityInNumbers>
                        <acceptedQuantity>20</acceptedQuantity>
                        <declaredQuantity>20</declaredQuantity>
                        <receivedQuantity>20</receivedQuantity>
                        <rejectedQuantity>0</rejectedQuantity>
                        <units>pcs</units>
                     </quantityInNumbers>
                     <quantityinWeight>
                        <acceptedWeight>0</acceptedWeight>
                        <declaredWeight>0</declaredWeight>
                        <receivedWeight>0</receivedWeight>
                        <rejectedWeight>0</rejectedWeight>
                        <units null="true" />
                     </quantityinWeight>
                  </item>

                  <item>
                     <_id>someItemId1</_id>
                     <description>someDescription1</description>
                     <productCatlgNo>someProductCatalogNo1</productCatlgNo>
                     <quantityInNumbers>
                        <acceptedQuantity>0</acceptedQuantity>
                        <declaredQuantity>0</declaredQuantity>
                        <receivedQuantity>0</receivedQuantity>
                        <rejectedQuantity>0</rejectedQuantity>
                        <units null="true" />
                     </quantityInNumbers>
                     <quantityinWeight>
                        <acceptedWeight>300</acceptedWeight>
                        <declaredWeight>300</declaredWeight>
                        <receivedWeight>300</receivedWeight>
                        <rejectedWeight>300</rejectedWeight>
                        <units>kgs</units>
                     </quantityinWeight>
                  </item>

            </itemList>
            <partyName>somePartyName</partyName>
            <receiptDate>someDate</receiptDate>
            <receiptNumber>someOtherStoresInwardReceiptNumber</receiptNumber>
         </someOtherStoresInwardReceiptNumber>

   </receiptList>
</data>

Is using subreport the only way to create this report? Or is there a way which we are not aware of?

Thanks in Advance.


Solution

  • We can "group by" these results either by Rcpt Date or by Dealer Name.

    Thanks