Cannot Calc sum

salemmsalemm Member Posts: 38
CurrForm.ItemAvailMatrix.MatrixRec.SETRANGE("Use As In-Transit",ShowInTransit);

IF ShowColumnName THEN
MatrixHeader := CurrForm.ItemAvailMatrix.MatrixRec.Name
ELSE
MatrixHeader := CurrForm.ItemAvailMatrix.MatrixRec.Code;

//Stock:=0;
//QtySoldNotPst:=0;

ItemLedgerEntry.RESET;
ItemLedgerEntry.SETFILTER("Item No.","Item No.");
ItemLedgerEntry.SETFILTER("Variant Code","Variant Code");
ItemLedgerEntry.SETFILTER("Location Code",'%1',CurrForm.ItemAvailMatrix.MatrixRec.Code);
//ItemLedgerEntry.SETFILTER("Posting Date",GETFILTER("Date Filter"));
IF ItemLedgerEntry.FINDFIRST THEN BEGIN
ItemLedgerEntry.CALCSUMS("Remaining Quantity");
END;

I wrote the highlighted line to get the sum of "Remaining Qty" but when i run the form i got an error see plz the image belowe

Comments

  • SavatageSavatage Member Posts: 7,142
    The message tells you what you need to do.
    Calcsums: Use this function to calculate the total of a column of SumIndexFields

    If you look at the keys of the Item Ledger Entry table. You don't have "Remaining Quantity" as a sumindex
    Either correct that or find a different way to accomplish your goal
    ILE.JPG 69.8K
  • bekiobekio Member Posts: 204
    Create e KEY in table 32 Item Ledger Entry with fields "Item No.","Variant Code","Location Code", and call this key after

    ItemLedgerEntry.RESET;
    ItemLedgerEntry.SETCURRENTKEY("Item No.","Variant Code","Location Code");
    ItemLedgerEntry.SETFILTER("Item No.","Item No.");
    ItemLedgerEntry.SETFILTER("Variant Code","Variant Code");
    ItemLedgerEntry.SETFILTER("Location Code",'%1',CurrForm.ItemAvailMatrix.MatrixRec.Code);
    //ItemLedgerEntry.SETFILTER("Posting Date",GETFILTER("Date Filter"));
    IF ItemLedgerEntry.FINDFIRST THEN BEGIN
    ItemLedgerEntry.CALCSUMS("Remaining Quantity");
    END;
Sign In or Register to comment.