Top 10 report show item rank entrytype Consumption

Dear All, I make a new this top 10 report by save as Inventory - Top 10 List. So I change source expression of text box from Item.Inventory to Qty and insert some code like this CLEAR(Qty); IF Item.Inventory <> 0 THEN BEGIN ItemLedgEntry.RESET; ItemLedgEntry.SETCURRENTKEY("Entry Type","Item No.","Variant Code","Drop Shipment","Location Code","Posting Date"); ItemLedgEntry.SETRANGE("Entry Type",ItemLedgEntry."Entry Type" :: Consumption); ItemLedgEntry.SETRANGE("Item No.",Item."No."); IF ItemLedgEntry.FIND('-') THEN BEGIN REPEAT Qty += ItemLedgEntry.Quantity; UNTIL ItemLedgEntry.NEXT = 0; END; END; ItemAmount.INIT; ItemAmount."Item No." := "No."; IF ShowType = ShowType::"Sales (LCY)" THEN BEGIN ItemAmount.Amount := "Sales (LCY)"; ItemAmount."Amount 2" := Qty; END ELSE BEGIN ItemAmount.Amount := Qty; ItemAmount."Amount 2" := "Sales (LCY)"; END; But something wrong because results of Qty is same every rank in spite of I CLEAR already,What wrong i did? klum

Hi klum, the field Inventory on the table Item is a FlowField, do you run the function “CALCFIELDS” in your code before? [?] Otherwise the value is always “0”. Best Regards feri

Hi feri, I have CALCFIELDS(Item.“Sales (LCY)”,Item.Inventory) already. Now I have solution like this at the end of the Integer - OnAfterGetRecord IF ShowType = ShowType::"Sales (LCY)" THEN Qty := ItemAmount."Amount 2" ELSE Qty := ItemAmount.Amount; Thanks koy