markonly and calcsum

Oneway
Oneway Member Posts: 53
Hi all

could ur guys tell me how to use function CALCSUM? It seems does not work after the markonly.

eg i setted some filters of the Cust. Ledger Entry, and then MARK all what i want. I tried use CALCSUM to calc the amount field. i faild.

Comments

  • kriki
    kriki Member, Moderator Posts: 9,132
    With the MARK + MARKEDONLY, the calcsums does not work.

    To use a SIFT-field, you make a record-var on the table of the SIFT-field (lets take Quantity in Item Ledger Entry) to make a sum of the different records.
    Then you have to put the filters on the record-variable to indicate which records you want to use for the sum.
    e.g.
    recItemLedgerEntry.RESET;
    recItemLedgerEntry.SETCURRENTKEY("Item No.");
    recItemLedgerEntry.SETRANGE("Item No.",'1000'); //take only records of item 1000.
    recItemLedgerEntry.CALCSUMS(Quantity); // total Quantity of records of item 1000.
    MESSAGE('The inventory=%1',recItemLedgerEntry.Quantity);
    

    Remark1: remember the recSomeTable.CALCSUMS("some field") will OVERWRITE the current value in "some field" of table "recSomeTable".

    Remark2:In table "Item Ledger Entry",in some index starting with "Item No." you need to define Quantity as SumIndexField.

    Remark3: the value of my example can also be obtained with field "Inventory" of table 27:"Item".
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!