Array Total

johnpaul.bolojohnpaul.bolo Member Posts: 6
Hi,

Need help, i want to generate a report from Item and Sales Line table that will show the following:

From Item Body (Total the Sales Line per Item,Customer,Dimension):
Code            Proj. Rsv. RMKS                          Retail Rsv. RMKS
                   (PROJECT)                                (RETAIL)
ItemA           20 AA001, 10 AA002                       5 BB001, 20 BB002
ItemB           5 AA001, 20 AA002....
********************************************************

Wherein:
ItemA          10 AA001, 10 AA001,4 AA002, 6 AA002       2 BB001, 3 BB001, 20 BB002
ItemB          5 AA001, 10 AA002, 10 AA002...
I use this code:
Item - OnAfterGetRecord()

sline.SETFILTER("No.",Item."No.");
sline.SETFILTER(sline."Shortcut Dimension 1 Code",'PROJECT');

IF sline.FINDSET THEN BEGIN
REPEAT
  IF (sline."Qty. to Ship" <> 0) THEN BEGIN
     ProRem[1]:=ProRem[1]+FORMAT(sline."Qty. to Ship")+'|'+sline."Sell-to Customer No."+', ';
  END ELSE BEGIN
     ProRem[1] := ProRem[1]+'';
  END;
UNTIL sline.NEXT = 0;
END;
sline.RESET;
.
..
...

Thanks In Advance. [-(

JPB

Comments

  • EugeneEugene Member Posts: 309
    since the number of projects is not fixed and can vary so the usual way to print is like this:
    ItemA
     Projects:
       AA001 20
       AA002 10                      
      Total for Projects 30
     Retails:
       BB001 5
       BB002 20
     Total for retails 25
    Total for Item 30 projects and 25 retails
    
    ItemB 
     Projects:
       AA001 5
       AA002 20
      Total for projects 25
    ...
    Total for all items N projects and M retails
    
    Do you know how many projects retails you will have ?

    IF you know let's say the number of projects will not exceed 10 or so then you could print them horizontally across several pages
    But in general printing varying number of sums horizontaly is not easily implemented and i'd suggest to export data to Excel instead
  • johnpaul.bolojohnpaul.bolo Member Posts: 6
    Thanks for your reply, correct me if i'm wrong, In your sample layout of the report it seems that i need to use the group total and tatal in sales line. But what i want is to create a total in item section where in the data is from sales line table. And if i export this to excel the array format will still be not in total arrangement per customer, and need to have a code to tatal in the level of item body section.

    And regarding of to print them in horizontal i can use STRLEN function to return the length of a string, then manipulate na maximum length of the record that will fit in the screen. and use the SHOWOUTPUT function to print the other record.

    MAJOR CONCERN:.....
    If there's a way to total the SLine."qty to ship" per customer in the section of ITEM BODY. please let me know.#-o
    MAJOR CONCERN:.....

    Please share some sample code's... to tatal the Sline qty, or "qty to ship" per customer in item body section in report. Thanks.

    JPB
    Eugene wrote:
    Eugene"]since the number of projects is not fixed and can vary so the usual way to print is like this:
    ItemA
     Projects:
       AA001 20
       AA002 10                      
      Total for Projects 30
     Retails:
       BB001 5
       BB002 20
     Total for retails 25
    Total for Item 30 projects and 25 retails
    
    ItemB 
     Projects:
       AA001 5
       AA002 20
      Total for projects 25
    ...
    Total for all items N projects and M retails
    
    Do you know how many projects retails you will have ?

    IF you know let's say the number of projects will not exceed 10 or so then you could print them horizontally across several pages
    But in general printing varying number of sums horizontaly is not easily implemented and i'd suggest to export data to Excel instead
  • EugeneEugene Member Posts: 309
    If there's a way to total the SLine."qty to ship" per customer in the section of ITEM BODY. please let me know.

    If i understand you right, you want printed something like this :
    Item No NNNN: QtyForCust1, QtyForCust2, QtyForCust3 ...

    Basically in Item dataitem on its AfterGetRecord trigger you have to define local record L_SalesLine variable set a filter on it and loop through it in REPEAT UNTIL L_SalesLine.NEXT= 0 summing your L_SalesLine."qty to ship" field. You will have to use an array of decimals to hold the qty for each customer.

    then in Item's body section you can use multipe texboxes with SourceExpr set to array elements
Sign In or Register to comment.