Writing a code: Main group wise-->Groupwise--> item report for sales, but even though the sample "stock groupwise item total" tdl works fine, adding a main group parameter does not gives the expected result. The inventory item part fails to explode. What am i missing ?? The format I am expecting is as follows if a Sales voucher has 8 items which are assigned to their groups which are also assigned to a higher level group: INVOICE------------------------------------------------------ Main Group-1 Sub Group-1 Item 1---Qty---Rate---Disc--Amount Item 2---Qty---Rate---Disc--AmountSub Group2 Item 3---Qty---Rate---Disc--Amount Item 4---Qty---Rate---Disc--Amount -------------------------------------------------- Main Group-2 Sub Group-3 Item 5---Qty---Rate---Disc--Amount Item 6---Qty---Rate---Disc--AmountSub Group-4 Item 7---Qty---Rate---Disc--Amount Item 8---Qty---Rate---Disc--Amount -------------------------------------------------- P.S: If I remove the "TSPL FFEMainGroup" part, it shows the collection OK, but of course without MainGroup. Here is the code i have tried so far. ;---------------------------------------- [#Form: SalesColor] Add : Print : TSPL FFEInvoice [Report: TSPL FFEInvoice] Use : Printed Invoice Delete : Form Add : Form : TSPL FFEInvoice [Form: TSPL FFEInvoice] Use : STDInvoiceDimensions Part : TSPL FFEMainGroup Space Top : 0 mms Space Bottom : 0 mms FetchObject : Stock Item: @@InvEntryList: Parent [Part: TSPL FFEMainGroup] Lines : TSPL FFEMainGroup Repeat : TSPL FFEMainGroup : TSPL MainGroup Coll Scroll : Vertical [Line: TSPL FFEMainGroup] Fields : TSPL FFEItemMarks1, TSPL FFEItemPackages1, TSPL FFEItemDescription1, TSPL FFEItemQty1, TSPL FFEItemRate1 Right Field : TSPL FFEItemAmount1 PrePrinted : Yes Local : Field : TSPL FFEItemMarks1 : Set As : $MainGroupName Local : Field : TSPL FFEItemPackages1 : Set As : "" Local : Field : TSPL FFEItemDescription1: Set As : "" Local : Field : TSPL FFEItemQty1 : Set As : "" Local : Field : TSPL FFEItemRate1 : Set As : "" Local : Field : TSPL FFEItemAmount1 : Set As : "" Explode : TSPL FFEItemsDes [Part: TSPL FFEItemsDes] Line : TSPL FFEStockGroup Repeat : TSPL FFEStockGroup :TSPL FFE Inv StkGrp Coll Scroll : Vertical [Line: TSPL FFEStockGroup] Fields : TSPL FFEItemMarks, TSPL FFEItemPackages, TSPL FFEItemDescription, TSPL FFEItemQty, TSPL FFEItemRate Right Field : TSPL FFEItemAmount PrePrinted : Yes Empty If : #TSPLFFEItemMarks1 ! = $MainGroupName Local : Field : TSPL FFEItemMarks : Set As : "" Local : Field : TSPL FFEItemPackages : Set As : $Name Local : Field : TSPL FFEItemDescription : Set As : "" Local : Field : TSPL FFEItemQty : Set As : "" Local : Field : TSPL FFEItemRate : Set As : "" Local : Field : TSPL FFEItemAmount : Set As : "" Local : Field : TSPL FFEItemPackages : SubTitle : Yes Local : Field : TSPL FFEItemPackages : Variable: StockGroupName Explode : TSPL FFEStockItemsPart [Part: TSPL FFEStockItemsPart] Lines : TSPL FFEItemsDetails Repeat : TSPL FFEItemsDetails : TSPL FFE Inv Coll Space Bottom: 2 mms Vertical:Yes Scroll : Vertical [Line: TSPL FFEItemsDetails] Fields : ItemMarks,ItemPackages,ItemDescription,ItemQty,ItemRemarks Right Field : ItemAmount Empty If : #TSPLFFEItemPackages ! = $Name Local : Field : ItemMarks : Set As : "" Local : Field : ItemPackages : Set As : "" Local : Field : ItemDescription : Set As : $StockItemName Local : Field : ItemQty : Set As : $BilledQty Local : Field : ItemRemarks : Set As : $Rate Local : Field : ItemAmount : Set As : $Amount [Collection: TSPL FFE Inv Coll] Source Collection : .. Walk : Inventory Entries Fetch : *.* Compute : Name : $Parent:StockItem:$StockItemName [Collection: TSPL FFE Inv StkGrp Coll] Source Collection : TSPL FFE Inv Coll Fetch : *.* By : Name : $Name Compute : MainGroupName : $Parent:StockGroup:$Name Aggr Compute : TotGroupAmount : SUM : $Amount [Collection: TSPL MainGroup Coll] Source Collection : TSPL FFE Inv StkGrp Coll Fetch : *.* By : MainGroupName : $MainGroupName Aggr Compute : TotMainGroupAmount : SUM : $TotGroupAmount [INCLUDE: vchfld.tdl] ; just contains field info to simplify the main code.