Report-Group By Order No. from Sales Shipment Line

liizzliizz Member Posts: 125
Hi all,

I am on a report whereby I need to group Order No. from Sales Shipment Line and make a sum of 'Quantity'. My report is based on Sales Shipment Header and Sales Shipment Line.

Lets' say for this e.g:
Order No. Quantity
101001 2
101001 3
101001 1
101001 2
101001 2
101001 2 Then, sum=12.

I do not want to make use of GroupTotalFields because there are more customizations which are required.

I have placed the Qty field on the Footer of Sales Shipment Line.

Sales Shipment Line, Footer (9) - OnPreSection()
SalesShptLine.RESET;
SalesShptLine.SETRANGE(SalesShptLine."Order No.","Sales Shipment Line"."Order No.");
SalesShptLine.SETFILTER(SalesShptLine.Quantity,'>%1',0);
IF SalesShptLine.FINDSET THEN BEGIN
REPEAT
Qty:=Qty+SalesShptLine.Quantity;
UNTIL SalesShptLine.NEXT=0;
END;

SalesShptLine:record variable and Qty:decimal variable.

The Qty calculation is being displayed accordingly but it is being shown three times for this mentioned Order No. as mentioned above. There should not be grouping on Document No.

Please help me.

Thanks
Liizz

Comments

  • gerrykistlergerrykistler Member Posts: 149
    What other data items are on your report? Do you have other Group Totals on the report?
    Gerry Kistler
    KCP Consultores
  • annivasuannivasu Member Posts: 10
    I think you should use Integer as a Data Item and set this Property Maxiteration =1 then call your code into Integer Footer section.
    Hope this will help you. :)
  • MGM08MGM08 Member Posts: 41
    Sales Shipment Line, Footer (9) - OnPreSection()
    if PrevOrderNo := "Sales Shipment Line"."Order No." then begin
    Qty := 0;
    CurrReport.Skip;
    end;

    SalesShptLine.RESET;
    SalesShptLine.Setcurrentkey("Order No.");
    SalesShptLine.SETRANGE(SalesShptLine."Order No.","Sales Shipment Line"."Order No.");
    SalesShptLine.SETFILTER(SalesShptLine.Quantity,'>%1',0);
    IF SalesShptLine.FINDSET THEN BEGIN
    REPEAT
    Qty:=Qty+SalesShptLine.Quantity;
    PrevOrderNo := "Sales Shipment Line"."Order No.";
    UNTIL SalesShptLine.NEXT=0;
    END;,
Sign In or Register to comment.